DebugLevel defines a reusable set of logging levels for assignment to TraceFlag objects. It controls how much detail Salesforce records for individual log categories. It does not identify the user, Apex class, or trigger to trace; those assignments belong to the trace flag.
Multiple trace flags can share one DebugLevel, so editing a shared definition can change logging for every flag that uses it. A definition alone does not mean tracing is active. Actual log capture depends on the applicable trace flags and runtime activity, not just the debug level's name or category settings.
Key Elements
Each log category has its own setting; there is no global logging-level element. The documented values for every category are NONE, ERROR, WARN, INFO, DEBUG, FINE, FINER, and FINEST. All documented category elements except dataAccess are required.
| Element | What the Element Controls |
|---|---|
fullName |
The metadata component's identity, inherited from Metadata. It is separate from the display label. |
label |
Required. The name displayed in Developer Console and Setup. |
apexCode |
Required. Detail about Apex execution. Events can include data manipulation language (DML) statements, inline SOQL or SOSL queries, and the start and completion of triggers and test methods. |
apexProfiling |
Required. Cumulative profiling information, including namespace limits and the number of emails sent. |
callout |
Required. External web-service callout detail, including request-response XML exchanged with the service. |
database |
Required. Database activity, including individual DML statements and inline SOQL or SOSL queries. |
dataAccess |
Optional. Rules and policy information for objects accessed through the user interface, useful for diagnosing why an object is inaccessible. |
system |
Required. Detail about calls to system methods, such as System.debug. |
validation |
Required. Validation-rule detail, including rule names and whether a rule evaluated to true or false. |
workflow |
Required. Workflow-rule detail, including rule names and actions taken. |
The other required categories are nba for Einstein Next Best Action activity and Strategy Builder execution details, visualforce for Visualforce events such as view-state serialization and formula evaluation, and wave for CRM Analytics activity such as template-processing errors and rules-execution summaries.
Behavior and Constraints
Category settings can overlap. apexProfiling provides cumulative information, while database exposes individual database operations. apexCode can also include database-related events, so these categories are not mutually exclusive partitions of a transaction.
Logging settings do not change access or business rules. dataAccess helps explain access decisions; it does not grant object access. Likewise, validation and workflow change diagnostic visibility, not the rules that execute or the actions they take.
Callout logs can contain payload content. Because callout can record request-response XML, interpret it as potentially capturing exchanged data, not merely whether a callout succeeded or failed.
Inspect trace-flag assignments when the output is unexpected. A correctly configured debug level can still be the wrong configuration to inspect if another applicable trace flag is involved. The name and category settings alone do not establish which runtime activity uses the definition.
A tooling enumeration can expose INTERNAL, but Salesforce's DebugLevel documentation does not list it as a valid value or define its behavior. Do not treat it as a documented logging mode.
Deployment and Retrieval
DebugLevel components use the .debugLevel suffix and reside in the debugLevels folder. The inherited fullName identifies the component; label supplies its display name.
The package.xml manifest supports wildcard retrieval for this type. Use <name>DebugLevel</name> with <members>*</members> to select all components of the type. See Deploying and Retrieving Metadata with the Zip File.
Include label and every required category when defining the component. dataAccess is the only documented optional category. The category values in a sample definition are examples, not required settings or defaults.
Deploying a debug-level definition does not by itself activate tracing. Likewise, a retrieved definition describes logging detail but cannot establish whether tracing is active or which users, classes, or triggers currently use it. Those questions require the applicable trace-flag assignments.
Relationships
The operational connection is to TraceFlag: a trace flag selects a debug level and identifies what to trace. This is a runtime record relationship, not an element inside the DebugLevel metadata definition.
Referenced By
-
TraceFlag:DebugLevelIdselects the reusable logging configuration. In the Tooling API, this value is aDebugLevelrecord ID, not the metadatafullNameor display label. See the TraceFlag object reference.
Reported Issues
-
Developer Console can produce more logging detail than a separate user trace suggests. In a 2017 discussion, opening the console reportedly established a
DEVELOPER_LOGtrace flag, distinct fromUSER_DEBUGflags. Respondents recommended inspecting the debug level assigned to the current console trace flag. They also describedCLASS_TRACINGflags as class/trigger logging overrides that do not generate logs by themselves. These areTraceFlagroles, notDebugLevelelements, and the discussion does not establish a general precedence rule for every combination of flags. See the Developer Console trace-flag discussion. -
Missing debug statements can result from log truncation rather than code not executing. A 2016 Apex-test discussion reported high-detail logs reaching the log-size limit and obscuring the desired messages. Respondents suggested a dedicated logging configuration with unrelated categories reduced and, when necessary, aligning
apexCodewith the explicit severity passed toSystem.debug. This is a reported diagnostic approach, not a required or default configuration. See the Apex-test logging discussion. -
A profiling-focused configuration can help investigate a query-limit failure that surfaces in a flow. In a 2022 discussion, a respondent recommended setting profiling to
FINESTand reducing unrelated categories toNONEorERROR. The respondent noted that query usage is cumulative across the transaction, so the flow where the failure appears might not be responsible for most of the queries. Treat this as a diagnostic configuration, not a default profile. See the flow query-limit profiling discussion.
Common Questions
Does deploying a DebugLevel enable debug logs?
No. It defines the category levels available to trace flags. Actual log capture depends on the applicable trace-flag assignments and runtime activity.
How do I retrieve all DebugLevel components?
Use DebugLevel as the type name and * as the member in package.xml. Components use the .debugLevel suffix in the debugLevels folder.
Why are my System.debug statements missing from the log?
Reported causes include truncation from high-detail logging and inspecting a configuration that is not assigned to the applicable trace flag. A reported approach is to reduce unrelated categories and align apexCode with the explicit severity used by the debug statements.
Can changing one DebugLevel affect other users?
Yes, if their trace flags share that definition. Multiple trace flags can use the same DebugLevel, so an edit is not necessarily limited to the person making it.
What is the difference between apexProfiling and database?
apexProfiling provides cumulative profiling information, such as namespace limits and email counts. database provides individual database-operation detail. apexCode can also contain database-related events.