Which events are logged depends on various
factors. These factors include your trace flags, the default logging levels, your API header, user-based system log enablement, and
the log levels set by your entry points.
The order of precedence for debug log levels is:
- Trace flags override all other logging logic. The Developer Console sets a trace flag when it loads, and
that trace flag remains in effect until it expires. You can set trace flags in the Developer Console or in Setup or by using the TraceFlag and DebugLevel
Tooling API objects.
- If you don’t have active trace flags, synchronous and asynchronous Apex tests execute with the default logging
levels. Default logging levels are:
- DB
- INFO
- APEX_CODE
- DEBUG
- APEX_PROFILING
- INFO
- WORKFLOW
- INFO
- VALIDATION
- INFO
- CALLOUT
- INFO
- VISUALFORCE
- INFO
- SYSTEM
- DEBUG
- If no relevant trace flags are active, and no tests are running, your API header sets your logging levels. API requests that are sent without debugging
headers generate transient logs—logs that aren’t saved—unless another logging rule is in
effect.
- If you enable system logs for a user, you get debug logs for that
user’s next 20 requests.
- If your entry point sets a log level, that log level is used. For example,
Visualforce requests can include a debugging
parameter that sets log levels.
If none of these cases apply, logs aren’t generated or
persisted.