Debug Apex

If you use Salesforce Extensions for Visual Studio Code (VS Code) for your development tasks, you have a choice of Apex Debugger extensions. Whichever debugger you chose, you set breakpoints in your Apex classes and step through their execution to inspect your code in real time to find bugs. You can run Apex tests in VS Code or on the command line.

Apex Replay Debugger

Apex Replay Debugger is available for use without any additional licenses. To configure and use it, see Apex Replay Debugger.

Apex Interactive Debugger

You must have at least one available Apex Debugger session in your Dev Hub org. To purchase more sessions for an org, contact your System Admin to open a case.

  • Performance Edition and Unlimited Edition orgs include one Apex Debugger session.
  • Apex Debuggers sessions aren’t available in Trial and Developer Edition orgs.
  • You can purchase Apex Debugger sessions for Enterprise Edition orgs.

Enable the Apex Debugger in your scratch orgs by adding the DebugApex feature to your scratch org definition file:

1"features": "DebugApex"

To configure and use it, see Apex Interactive Debugger.

ISV Customer Debugger (Salesforce Extensions for VS Code Only)

ISV Customer Debugger is part of the Apex Interactive Debugger (salesforcedx-vscode-apex-debugger) extension, so you don’t have to install anything other than the Salesforce Extension Pack and its prerequisites. You can debug only sandbox orgs.

See ISV Customer Debugger in Salesforce Extensions for VS Code for details.