5

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).

1
  • See if the approach of using an extension for this works for you. I've explained it here: stackoverflow.com/questions/58174681/… Notice the |DEBUG| keyword is in every user debug line of the log files.
    – Bahman.A
    Jun 15, 2022 at 17:30

3 Answers 3

3

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.

sf apex tail log --color | grep 'USER_DEBUG\|FATAL_ERROR'

Updated to latest CLI syntax.

2

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

Reference:

1
  • Can someone verify this works?
    – Tyler Zika
    Sep 19, 2021 at 20:35
1

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

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

You must log in to answer this question.

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