Which tool to use?
We have now seen a number of options to debug our code and improve our workflow from the standard workflow for most developers, which is usually as follows:
- Perform action in Salesforce UI
- Review debug log
- Update code
- Repeat
Hopefully, it has now become clearer that replicating any issue in Apex code through a unit test will speed up our debug cycle immensely as it allows us to utilize the debugging tools available to us in VS Code and SFDX without a need to return to the browser repeatedly. I often find as well that the process of methodically writing a unit test to reproduce the error can make my brain have a small “aha” moment, allowing me to fix the issue straight away. If this doesn’t happen, though, we are left with two main improved ways of debugging, as follows:
- Filtered log levels and streaming logs to the terminal for inspection
- Using the Apex Replay Debugger
A sensible question is, therefore...