CLI for filtering USER_DEBUG output from Salesforce Anonymous Apex execution logs
When executing Anonymous Apex using sfdx force:apex:execute
the logs contain a lot of debug information.
If you want to show only the output coming from System.debug()
this is the tool to use.
Unlike a simple grep '|USER_DEBUG|'
this supports multi-line messages.
Compare the following output from running System.debug('Hello World\nThis is a debug message.')
:
full | filtered |
---|---|
Compiled successfully. Executed successfully. |
Hello World! This is a debug message. |
$ npm install -g apex-log-filter
$ echo "System.debug(UserInfo.getUserName());" | sfdx force:apex:execute | apex-log-filter
john.doe@example.com
MIT © Matthias Rolke