Salesforce Replay debugger

Salesforce Replay debugger



About
Salesforce Replay debugger is a debugging tool for the apex. It steps over apex code through debug logs. In this article, we will set up and use replay debugger in vscode.

perquisites Needed for replay debugger

STEPS
  1. Setup debug log in the system. In the debug logs make sure the Apex Code level debug level is Finest and the Visualforce page debug level is Finer
  2. Note : For the  Default SFDC_DevConsole debug level, Apex Code debug level is Finest and the Visualforce page debug level is Finer.


  3.  Download debug logs in the visual studio Code.  To download debug logs open command palette (Ctrl + Shift + P for windows, Cmd + Shift + P for mac).   Then Select 'SFDX: GET Apex Debug Logs'. 
List of recent Logs

    From the list of logs select the log which you want to debug. 


    4. On clicking the log, It will get downloaded on the system and will show up on the screen.



    5.    Now set up breakpoints on the apex code by left-clicking just left of the line number.      
                             


    6.     Now go to the debug log, Right-click and then select 'Launch Apex Replay debugger with
              Current File'. 

                


 7.   On clicking 'Launch Apex Replay debugger with Current File' a debugger menu will show up                 on the screen.  Now click on play icon at the top.
            
    Note: if the debugger menu is not showing up then try restarting vscode and setting up debug logs                  again. Start fresh by creating new logs.

8.  On clicking play, debugger will stop at the line on which the breakpoint was set.


You can click on the debug icon to look at the state of variables. (Debug icon is marked with an arrow in the above image).

9. Click on step over icon (Marked with arrow to move to next).


10. Congrats, You have setup debug logs successfully.





Comments

Popular posts from this blog

Salesforce CI/CD Pipeline | Bitbucket

Salesforce ANT Setup for MAC

Salesforce FLS Exporter