I am trying to do some research, and coming across a stumbling block. Execute Anonymous
seems to sometimes hit a statement that breaks all further debugs.
system.debug('Statements do appear'); // shows up
try
{
system.debug(Timezone.getTimeZone('America/New_York')); // never shows up
throw new DmlException();
}
catch (Exception pokemon)
{
system.debug(pokemon); // never shows up
}
However, if I change the DmlException
above to LimitException
, it does throw, so I know the execution is not halted. What's going on?
Logging Levels:
Even if I change my LoggingLevel
on the above debug
statements to ERROR
, the behavior remains unchanged. But if I change the ApexCode
level to FINEST
, it works. Why?
Best Answer
TL;DR Looks like a bug to me. Changing the APEX_PROFILING logging level is enough to get the missing debug statements to appear.
The Known Issue is now marked as "FIXED - WINTER '17"
As per the discussion, I've reproduced this in the developer console.
If I set the log levels to only ApexCode: DEBUG and System: ERROR I get the following raw log:
Then changing the APEX_PROFILING to DEBUG and keeping the other levels the same:
Raised as Support Case #13877926
I've also encountered some other similar scenarios and have Support Case # 14135299 open. In one case Calling
User.Info.getTimeZone()
is causing the messages to drop. In another case they just stop appearing for several lines in a CanvasLifecycleHandler and then resume again. In both cases setting the ApexClass logging level to fine got them to appear again.