Skip to content

Salesforce Apex Log: TraceFlags creation, allow selecting initial DebugLevel (other than "ReplayDebuggerLevels") when creating a new TraceFlag #7262

@AndrewStopchenko-SO

Description

@AndrewStopchenko-SO

Summary

In the new "Trace Flag" toolbar item, the traceFlags.json document allows creating a new TraceFlag record for the current User/other User via corresponding in-text commands ("Create trace flag for current user", "Add trace for another user").
However, the new TraceFlag gets created with the "ReplayDebuggerLevels" DebugLevel assigned by default, where all logging levels are maxed out, producing massive log files with noisy output - those are good for ReplayDebugger, but not so good for reading the USER_DEBUG outputs when needed.

As a result, when trying to debug Apex code with some USER_DEBUG outputs, the current UX is:

  • create new TraceFlag record (auto-assigned with the noisy "ReplayDebuggerLevels" DebugLevel); Apex logs sizes grow making it harder to scan-through for the USER_DEBUG entries.
  • use Change command on the "debugLevelName" property of the created TraceFlag record to switch it to some less noisy DebugLevel, e.g. "SFDC_DevConsole".
    • Alternatively, open DevConsole in the Org and setup DebugLevels there (auto-creates TraceFlag for current User with "SFDC_DevConsole" DebugLevel assigned).

== Suggested UX improvement ==

At the same time, if a TraceFlag already exists (or was created) for the User, there is a separate Change in-text command above the "debugLevelName" property, which opens a Debug Levels picker; selecting one of them applies selected DebugLevel to the TraceFlag record.

Image

It would be great if the "Create trace flag for current user" command reuses that same Debug Levels picker for the initial DebugLevel assigned for the new TraceFlag record.

Steps To Reproduce:

  1. Hover mouse over the "No Tracing" toolbar item; click the "Full trace flag details" link in the popup.
  2. In the traceFlags.json document, if any TraceFlags exist for current User, use "Remove" in-text command so that the list of current user's TraceFlags is empty.
  3. Click "Create trace flag for current user" in-text command.

Expected result

After step 3:

  1. display Debug Levels picker with the list of currently existing DebugLevels, requesting user to select one of them.
  • When DebugLevel is selected, the new TraceFlag is created with selected DebugLevel assigned.
  • If user cancelled the Debug Levels picker - either cancel the TraceFlag creation command completely, or fallback to auto-assigning the "ReplayDebuggerLevels" DebugLevel.

Actual result

After step 3, TraceFlag gets created with "ReplayDebuggerLevels" DebugLevel assigned by default. If lower debugging levels are needed, user has to change the DebugLevel by running another command.


Salesforce Extension Version in VS Code: 66.8.0

Salesforce CLI Version: @salesforce/cli/2.131.7 win32-x64 node-v22.22.2

OS and version: Windows_NT 10.0.19045

VS Code version: 1.117.0

Most recent version of the extensions where this was working: N/A

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions