I am using VS Code with the apex replay debugger. I setup a Debug log for my user with Apex set at Finest and Lightning set at finer. I am executing a report on the Salesforce Org for that user. After downloading the log for the report, I set a breakpoint where the data is loaded for the report. The breakpoint is never hit. When I look at the log, I can see the methods are in the log. Is there some other kind of configuration that I need to do in the org or in VS Code?

Besides the Apex setting at Finest and the Lightning set at Finer, what should the other log levels be?

  • Have you ran this command SFDX: Turn On Apex Debug Log for Replay Debugger ? – Robs Jan 28 at 15:01
  • @Robs That command pretty much just sets The Apex log level to Finest, the Visualforce log level to Finer, and the expiration to [a little bit in the future]. Nothing too fancy, and as long as those two levels are correctly set, you don't necessarily need to run that command. – Derek F Jan 28 at 15:07
  • Yes, I have tried that. After about 5 minutes of it executing the log (it is a 4.5MB log) then it just exits without hitting a breakpoint. – Greg Finzer Jan 28 at 15:15

The other log levels don't matter. It's just Apex = finest and Visualforce = finer (the log category I see is "Visualforce", not "Lightning").

A good approach to debug the debugger would be to start with a breakpoint at a point with the most shallow call stack possible (i.e. if your call stack is Class B.method <= Class A.method <= trigger on object, start with a breakpoint early in the trigger, which is at the bottom of the call stack).

Once you verify that you can, in fact, hit a breakpoint, you can start setting ones deeper in your call stack. Right now, for all you know, the code you think is being executed isn't actually being executed.

Other things that have bit me with the replay debugger:

  • Make sure you're executing the code in the org you think you are using. Even small differences in code can cause issues with the debugger. I've (once or twice) pulled a log from production while trying to debug code in a developer sandbox. It didn't work very well.
  • Sometimes, VSCode just needs the good, old-fashioned "turn it off and back on again". VSCode is based on Electron/Chromium (i.e. Node.js), which can work its way into some strange states. Restarting VSCode should clear out any accumulated funk from Electron/Chromium.
  • If your log is too large (sounds like that may be the case here), Salesforce will truncate your log at an arbitrary point. It's quite possible that the line you're trying to break on falls into the part of the log that was truncated (and therefore the debugger can't reach that part of your code)
  • The problem was the log file was too big and there were too many logs. Salesforce just started giving up. – Greg Finzer Feb 4 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.