+ Start a Discussion
אביב קסוטואביב קסוטו 

system.debug writes trimmed content

I have an issue where i run an apex class and print some objects along the way to log using `System.debug()`.

my problem is that for some reason, the log rows are getting written, but the value of the objects is being "trimmed". the size that it writes and which gets trimmed isn't consistent (sometimes it prints a lot of content sometimes less) but it does not write the entirety of the objects values i choose to log.
It does this to both SObjects and json encoded strings, and my entire log size is just about 80KB so i know i'm not breaking some size limit.

I also checked my log levels and everything is set as it should (again my logs are being written just not "fully").

for example, I have the json string:


But it gets written to the log file as:

    15:29:57:085 USER_DEBUG [69]|DEBUG|payments json: [{"sum":"2300","serial":"","repaymentDate":null,"payment":{"attributes":{"type":"Payment__c"},"Payment_Method__c":"Cash","checkdate__c":null,"Payment_Collected_Date__c":"2019-03-11"},"ownerId":null,"numOfPayments":null,"firstPaymentAmount":null,"digits":null,"cardType":null,"branch":nu

any ideas?
If you haven't , try using the word 'Pretty'. here's an example - 
List<Account> accounts = [SELECT id, name FROM Account LIMIT 2]; 
system.debug('>>>>>>>>>>>>>>>> ' + JSON.serializePretty(accounts));
The output is 
  "attributes" : {
    "type" : "Account",
    "url" : "/services/data/v24.0/sobjects/Account/001d000000Ard7uAAB"
  "Id" : "001d000000Ard7uAAB",
  "Name" : "United Oil & Gas, Singapore"
}, {
  "attributes" : {
    "type" : "Account",
    "url" : "/services/data/v24.0/sobjects/Account/001d000000Ard7vAAB"
  "Id" : "001d000000Ard7vAAB",
  "Name" : "Edge Communications"

אביב קסוטואביב קסוטו
You misunderstood my problem, it doesn't matter if it is a string or an object (or how it is parsed for that matter), the value gets trimmed when i view the logs in the developer console

According to your statement "It does this to both SObjects and json encoded strings,", I am assuming this can give a possible explanation. Please take a look : https://developer.salesforce.com/forums?id=9062I000000QvOTQA0

Krishna Avva
אביב קסוטואביב קסוטו
This would explain it if my strings were that big, but as you can see in the question the string i provided is only 312 characters long, and it still "cuts it" down to 286, so i'm nowhere near the size mentioned in that question...