When using Visual Studio Code and Salesforce DX palette command:

SFDX Get Apex debug logs...

To get an Apex Log from the Salesforce servers, how can I then filter the output so I can only see the DEBUG statements? (like in the developer console).


You can run this in the VSCode terminal and the debug logs will be rendered there for you when you run your unit tests, etc.

sfdx force:apex:log:tail --color | grep --line-buffered "USER_DEBUG"

I think you can use Logpoints feature of debugger instead of USER_DEBUG (system.debug).


  • Can someone verify this works?
    – Tyler Zika
    Sep 19 '21 at 20:35

It's works for me (insert into cmd):

sfdx force:apex:execute -f "<myfilewithsystemdebug>" | grep --line-buffered "USER_DEBUG"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.