[SalesForce] MAXIMUM DEBUG LOG SIZE REACHED

I am running Apex Tests and I need to see the debug value
So I have used debug statements similar to below one:

System.debug(Logginglevel.ERROR , ' ::::::: My Debug :::::::::::::') ;

Still I am unable to see the messages in debug log b/c of max debug log size issue.

I am not sure why the levels are not changed in the above debug log.

enter image description here

Best Answer

Generally speaking, you can control the logging level using the TraceFlags.

TraceFlags have overriding authority over all other tracing methods. See Summer '15 Release notes - Receive Debug Logs Predictably.

As per Does the Summer ’15 release remove the ability to set test logging levels with the DebuggingHeader?, the current modifications seem a bit off to me, but they can be made to work.

So long story short, use the Developer Console Debug > Change Log Levels option to set your user level trace flags. You can also set specific trace flags for apex classes and triggers. These will be applied when capturing asynchronous test results.

enter image description here


If you want to go further, you can still exert control of the logging levels through other means. One option is to not have no active TraceFlags set when running the tests. This also requires having Developer Console closed, as it will set active TraceFlags when opened.

You can perform a synchronous test run using the Apex API and set a specific logging levels in the DebuggingHeader. If your interested in this approach I've made a tool that allows you to call this method for selected test classes or methods with defined logging levels.

enter image description here

Related Topic