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 prints 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:
[{"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":null,"bank":"","account":""}
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?
Best Answer
Update: This is now specifically called out in the release notes.
Developer Console: String Values in Debug Logs Are Truncated
I'm not able to replicate this issue with anonymous Apex. I tested with the following against the v45.0 API.
Raw Log Output:
I'd expect the JSON object to be truncated in a
System.debug()
, but not a raw string.What I did find was that the Developer Console was truncating it in the Details column:
So, either work with the raw log, or (shameless self promotion for a free tool I make) use and alternative log viewer.