I am trying to debug my code when running apex tests, but I cannot see my System.debug statements because there are a lot of log entries like


and at the end:

*********** MAXIMUM DEBUG LOG SIZE REACHED ***********

How can I configure it for tests to show only debug messages in developer console?

  • Did you see this - help.salesforce.com/…
    – Raul
    Oct 18, 2016 at 14:24
  • 2
    While some answers have been provided, it's usually far more effective to purposely cause test failures via System.assert than it is to try and debug stuff and read the logs.
    – sfdcfox
    Oct 18, 2016 at 14:43
  • @sfdcfox That kind of depends on how much of the control flow you need to see. If you need more than one data point, it's not that useful of a strategy.
    – Adrian Larson
    Oct 18, 2016 at 14:45

3 Answers 3


In the console, go to Debug > Change Log Levels. You'll see the following dialog:

Change DebugLevel

If you want a specific setting for your tests, click the Add button, and name it something like Test_Debug. Usually I specify NONE for all levels except DEBUG for ApexCode and ERROR for System. Although it seems there is no longer an ERROR option for System, so you may want to go with INFO.

Add DebugLevel

If you still get truncated logs, set ApexCode to ERROR as well and log at that specific level:

system.debug(LoggingLevel.ERROR, 'Some info');

Generically speaking, you need to set the logType in the DebuggingHeader to "Debugonly" when running the unit tests. Each platform will have a different means of accomplishing this. For example, the Eclipse Test Runner has a slider you can use, the Developer Console has a menu option, and the Ant Migration Tool has an attribute you specify when running tests. Specifying the correct level should give you your debug statements without too much extra clutter.


An alternative to digging through test logs is to set up checkpoints in the developer console. It's a bit more complicated than simply looking for debug statements, but can provide much more information (and doesn't require code changes to look at different parts of the execution state).

See Do Checkpoints work with Unit Tests?

You'll need to have an active trace set up on yourself, the Apex log level set to 'finer' or 'finest', and I believe you can only set code checkpoints via opening your target file in the dev console.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .