[SalesForce] Visual Studio Code – Developer Console

I have been trying to use Visual Studio code over the Developer Console because I understand that this will be the new standard for Salesforce however I find myself using the Developer Console with Visual Studio Code. The reason I use the DC with the VS Code is because while I am writing the code for the business processes I heavily use the Logs in DC with System Debug statements. My question is can VS Code also show the Logs like the DC? I get that you can create test classes and run it that way but I find using this is rather challenging when programming.

Best Answer

You can actually stream the debug log into your local computer with VSCode + Salesforce CLI tool.

Assuming you have the Salesforce CLI tool installed. To see debug log without leaving your VSCode, run this command in the terminal tab:

$ sfdx force:apex:log:tail -c | grep '|USER_DEBUG|'

Then, try create a new file within VSCode, type in below

System.debug('Hey!');

and run SFDX: Execute Anonymous Apex with Editor Contents. You'll see the log is streamed to your console.

Check out the documentation.