Unable to debug due to incomplete debug logs

Issue #353 resolved
Ilya Leshchuk created an issue

Tried to debug anonymous apex, selected "Full Debugging" preset, executed the code, but after the execution when you click on "Step Over" debugging just ends. When looking into log looks like it misses the beginning and starts somewhere in the middle of a process which causes debugger to fail. Very start of a debug log is attachedlog.png

Comments (4)

  1. Scott Wells repo owner

    Ilya, this is most likely due to Salesforce's maximum log size limit. Debug logs can be no larger than 2MB in size, and Salesforce will truncate the log somewhat arbitrarily, sometimes at the beginning and sometimes at the end. For full debugging (stepping, showing variable assignments, etc.) to work, a full log is needed. If you're debugging a process that generates a log larger than 2MB, you'll need to set the log levels lower and use checkpoints to examine heap variables at key locations along the way. I've included two additional log levels (stepping with checkpoints and checkpoints-only) to help facilitate this situation.

    Please let me know if that information doesn't help you debug this process.

  2. Ilya Leshchuk reporter

    Hi Scott! Thank you for the quick response. I was aware about maximum log size limit, I just couldn't imagine SF will cut it from the beginning. Lowering log levels helps. Thanks again.

  3. Scott Wells repo owner

    Yeah, it's pretty strange how unpredictable it can be. Here's a short thread about it:

    https://developer.salesforce.com/forums/?id=906F0000000AyNsIAK

    I remember Salesforce actually makes their own statement about having no guarantees about where truncation where occur, but I'm not finding it right now.

    I'm going to resolve this issue for now. Please feel free to reopen if you still can't work around this limitation. It just makes me happy to see that more and more people seem to be using the debugger now!

  4. Log in to comment