For the longest time I have been using
System.debug(JSON.Serialize(o))
to output objects to the debug log for troubleshooting purposes. This has worked up until my most recent project. Even existing code seems to be having this behavior.I’ve tested API versions 41-45 with no luck. The actual line of code I’m using is:
system.debug(json.serialize(accountsToInsert)); // This is a map
I have also tried:
system.debug(json.serialize(accountsToInsert.get(Key)));
AND
Account test = accountsToInsert.get(Key); system.debug(json.serialize(test));
The code is called from a method defined in a VF page
action
attribute.Is this just a thing that we have to live with now? Is there another way to get a full look into the state of an object at run time?
Answer
Unfortunately, since Spring’19 in order to improve performance, Salesforce changed a way how long strings are shown in the Developers Console.
Now strings are now truncated at 512 characters in the Developer Console’s Log Inspector
In order to retrieve full log, it is needed to use Open Raw Log in Developers Console menu.
Release notes with more information – https://releasenotes.docs.salesforce.com/en-us/spring19/release-notes/rn_forcecom_developer_console.htm
Some Suggestions:
- The Apex Replay Debugger is a powerful debugging tool – Note Seems to have issues with very large debug logs.
- Checkpoints can be used to inspect objects at given points in code using the developer console.
- Apex Interactive Debugger – This has become my personal favorite debugging tool.
Attribution
Source : Link , Question Author : gNerb , Answer Author : gNerb