

The –debugLevel command is optional but allows you to define your own debug level by inserting records into the TraceFlag object (via the DX CLI command force:data:record:create). Maybe you want to parse out some information to profile how many SOQL statements have been used or aggregate timestamp values (the bit in brackets after the time!) to do some performance profiling… I am looking forward to seeing what folks do with this, please share! One of the most exciting features for me is the ability to pipe debug logs. You can also customize your own colors by setting the SFDX_APEX_LOG_COLOR_MAP environment variable to an absolute file path to a JSON file per the format shown below. The –color parameter used above enables some basic color highlighting for method, constructor, variable assignments etc. However, if you run it from the same folder as a DX project it will use the currently configured default user/scratch org for that project.Īdding a bit of color to your debug logs! The command works against any org you have connected to the DX CLI, including production and sandbox orgs. Pictures do not really do it justice, so here is a short demo video! sfdx force:apex:log:tail -color | grep USER_DEBUG or add the -u command-line switch to python command: program:x command python -u file.py. In the following command line example, I have piped the output to another command ( grep) that filters the output to show only USER_DEBUG log lines. Setting the environment variable PYTHONUNBUFFERED1 in you nf will disable buffering and show log messages sooner: program:x environment PYTHONUNBUFFERED1. Note that you do not need to have a DX project to use this command.
Could not run logtail or save output install#
You can install the Salesforce DX CLI here. This is similar to the experience in Developer Console logs pane, but is effectively opening the logs and dumping them out as they are produced on the server for you automatically. Maybe you are reproducing a bug and are watching for a certain SOQL query or method being executed or we just want filter output in different ways.Ī recent addition to the DX command line from Chris Wall is the ability to effectively stream debug logs from any org connected to DX to the command line console. While the Apex Interactive Debugger provides an interactive experience, sometimes you want to monitor, parse or filter logs.

Debug logs are a key tool in triaging and profiling on the Lightning Platform (formerly ) both in development and production.
