1

I am having very very very frustrating problem here. I am coding my app, dumping to debug logs whatever I need and everything works magically. But at some point apex stops printing my debug logs. So i have system logs, I can read them, but not the logs dumped with system.debug(");

My debug log request limit is not used, I didn't touch or change Debug Log levels in Developer console. It just stops printing debug logs from methods being called.

This is not the first time this happens, it is recurring event unfortunately.

Did anyone experience something similar or does anyone have some idea what to do regarding this issue. Thanks a lot.

3
  • I forgot to mention that later I tried to explicitly set (finest, fine or debug) log levels for these few classes i am working on currently but no luck with that.
    – luciferche
    Commented Sep 16, 2015 at 12:01
  • What's the size of the debug logs? They aren't hitting the log size limit before they hit your debug statements are they?
    – Girbot
    Commented Sep 16, 2015 at 12:16
  • they are around 1.80 - 2 MB
    – luciferche
    Commented Sep 16, 2015 at 12:21

3 Answers 3

1

On occasion I've seen the debug logs come in seemingly well under the limit, yet still have this in there somewhere:

**** skipping 12000000 bytes of detailed log ****

Although it's not a silver bullet, if you want to ensure that you see at the very least your explicit calls to System.debug, you can specify a logging level:

System.debug(LoggingLevel.ERROR, 'your debug statement here');

Then when setting your log filters on the Debug Logs page, set every category to NONE, with the exception of the Apex Code category, which you'll want to set to ERROR.

You should then be able to generate a much smaller log that will contain the output of all System.debug statements.

1
  • Thanks, interesting, I wouldn't catch that skipping in logs :) But there are no logs about skipping either. I will try this approach just in case
    – luciferche
    Commented Sep 16, 2015 at 13:41
1

The debug log has a max size of 2MB.

Log entries for events that are necessary for processing the debug log don't get truncated and will always be part of the debug log, but other log information that appears between the start and end lines of these log entries is removed as part of log truncation. (Most notably, system.debug statements)

In order to provide the most pertinent information, debug logs are truncated starting with the oldest log entries. The newest log entries are always preserved. The debug log is truncated by 200 KBytes when it reaches its maximum size of 2 MB.

So, you will most likely need to pare down the amount of information that is being output via debug statements in order to be able to view the data that you're looking for in the log. (i.e. commenting debug statements you're not using, commenting debug statements that output large collections of data, etc.) If you have 2MB worth of data from items from the list below, you will probably need to test a smaller block of code to reduce the number of lines logged.

From the Docs:

Each debug log can only be 2 MB. 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.

https://help.salesforce.com/apex/HTViewHelpDoc?id=code_debug_log.htm

These items will never be removed from the log:

  • EXECUTION_STARTED
  • EXECUTION_FINISHED
  • CODE_UNIT_STARTED
  • CODE_UNIT_FINISHED
  • METHOD_ENTRY
  • METHOD_EXIT
  • CONSTRUCTOR_ENTRY
  • CONSTRUCTOR_EXIT
  • SOQL_EXECUTE_BEGIN
  • SOQL_EXECUTE_END
  • SOSL_EXECUTE_BEGIN
  • SOSL_EXECUTE_END
  • CALLOUT_REQUEST
  • CALLOUT_RESPONSE
  • FATAL_ERROR
1
  • Thanks Mark. I will try to clear out anything not necessary and set the debug logs differently. I hope it will help.
    – luciferche
    Commented Sep 17, 2015 at 8:47
0

This seems like a duplicate of this question about debugging through the Developer Console.

I'm not sure if this is the same issue, but if you go to Debug > Change Log Levels.. you may see that one or more items have expired.

For me, if I set the Expiration value to a time later than now, the debug logs start working again.

1
  • This is not the issue in this case. They are not expired.Thanks
    – luciferche
    Commented Sep 16, 2015 at 13:44

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