When running anonymous apex in the Developer Console, you have the option to filter down to show only the Debug lines - is this possible when running anonymous apex from VS Code?

I see the full output in the Output panel and can manually scroll through to find the debug lines.

I can use SFDX: Get Apex Debug Logs to retrieve the full debug log too - what's the best method to filter down to only the debug lines?

Should it be this command to launch the debugger? I'm missing this option.

SFDX: Launch Apex Replay Debugger with Current File

1 Answer 1


You can use this command to see live logs

sfdx force:apex:log:tail --color | grep USER_DEBUG

the grep USER_DEBUG will display only lines related to System.debug calls

You can also run this command with a single click using VsCode SFDX Hardis extension with command Display live logs in terminal

enter image description here

  • Thanks. I had just installed the Hardis extension and was looking through it too. When I run the anon apex vs code automatically open the Output tab - is there a way to stop it so it remains on the terminal where the debug log shows?
    – benji1304
    Commented Jan 5, 2023 at 22:41
  • Run anonymous code command is managed in Salesforce core Vs Code extensions, so Sfdx Hardis has no way to change that :/ Commented Jan 6, 2023 at 8:26
  • if it can help, code is here, you may ask the maintainers for a PR that would allow some connfig param to not switch of output tab when running the command :) github.com/forcedotcom/salesforcedx-vscode/blob/main/packages/… Commented Jan 6, 2023 at 8:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .