Firstly, this question isn't about how to access missing log content when a *** Skipped 53353122 bytes of detailed log
style message is encountered. That is covered in another question and revolves around altering log levels.
I'd like to know when and how Salesforce applies this log content skipping functionality.
- What determines its location in the log?
- What log messages get kept and which get skipped over?
Anecdotally it seems to appear around the middle of the log for me, which always makes me think I'm missing a significant portion from the middle of the log file.
I did find the following in the Debug Log docs:
Each debug log must be 2 MB or smaller. Debug logs that are larger than 2 MB are reduced in size by removing older log lines, such as log lines for earlier System.debug statements. The log lines can be removed from any location, not just the start of the debug log.
It still seems a bit arbitrary about what will be removed once you reach the log file size limit. Why cull one log message over another? Why not just run until the MAXIMUM DEBUG LOG SIZE REACHED message and then stop logging?
In a discussion with Chris Peterson he indicated that in more recent API versions (post v24.0?) that lower severity events are evicted first. Some basic testing based on @sfdcfox's comments using large log messages can (kind of) show this.
Try changing the LoggingLevel on each debug statement. With no levels defined the d
's got logged and everything else skipped. As it is below the b
's get logged and everything else skipped. Where did the a
's go? (Info > Debug > Fine)
System.debug(LoggingLevel.Info, 'a'.repeat(1500000));
System.debug(LoggingLevel.Debug, 'b'.repeat(1500000));
System.debug(LoggingLevel.Fine, 'c'.repeat(1500000));
System.debug(LoggingLevel.Finest, 'd'.repeat(1500000));
Update: It appears to be nondeterministic. Running the same anonymous Apex with the same logging levels results in differing log output. Sometimes only the b
's messages appear along with a skipped message. Sometimes the a
's appear. Sometimes I get a MAXIMUM DEBUG LOG SIZE REACHED
.
System.debug('*'.repeat(2300000));
does...?