---
schema_version: "1"
id: abe4be44c384fabb5bd81d55cb287bf3399b05230d9ef7c38dd58bbeaa3b7bc1
title: Debug Log Order of Precedence
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/code_debug_log_precedence.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.code_debug_log_precedence.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 39e721300d6735d776a6e15611e0c9bd9926a346618f8a0dabfe18b6ae5caf0d
description: 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.
products:
  - Salesforce Platform
release: "264"
---
# Debug Log Order of Precedence

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.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Salesforce Classic (<a href="https://help.salesforce.com/s/articleView?id=xcloud.overview_edition_lex_only.htm&amp;type=5&amp;language=en_US" target="_blank">not available in all orgs</a>) and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <span id="code_debug_log_precedence__Apex_Code_editions_text"><a name="code_debug_log_precedence__Apex_Code_editions_text"></a><strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, <strong>Developer</strong>, and <strong>Database.com</strong> Editions</span></td></tr></tbody></table>

The order of precedence for debug log levels is:

- (1) 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.
    
    ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_code-264-0-0-production-enus/789bc523-706b-4ae4-8fe9-be6322e38b6b/images/icon_note.png)
    
    Note Setting class and trigger trace flags doesn’t cause logs to be generated or saved. Class and trigger trace flags override other logging levels, including logging levels set by user trace flags, but they don’t cause logging to occur. If logging is enabled when classes or triggers execute, logs are generated at the time of execution.
- (2) If you don’t have active trace flags, synchronous and asynchronous Apex tests execute with the default logging levels. Default logging levels are:
    
     
    | Test | Logging Level |
    | --- | --- |
    | DB | INFO |
    | APEX\_CODE | DEBUG |
    | APEX\_PROFILING | INFO |
    | WORKFLOW | INFO |
    | VALIDATION | INFO |
    | CALLOUT | INFO |
    | VISUALFORCE | INFO |
    | SYSTEM | DEBUG |
- (3) 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.
- (4) 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.

#### See Also

- [Set Up Debug Logging](https://help.salesforce.com/s/articleView?id=xcloud.code_add_users_debug_log.htm&type=5&language=en_US)
- [Logs Tab](https://help.salesforce.com/s/articleView?id=platform.code_dev_console_tab_browser_logs.htm&release=264.0.0&type=5 "Use the Logs tab in the Developer Console to access logs that include database events, Apex processing, workflow, callouts, and validation logic.")
- [Debug Log Details](https://help.salesforce.com/s/articleView?id=platform.code_debug_log_details.htm&release=264.0.0&type=5 "A debug log includes a header, execution units, code units, log lines, and other log data.")
- [Debug Log Levels](https://help.salesforce.com/s/articleView?id=platform.code_setting_debug_log_levels.htm&release=264.0.0&type=5 "To specify the level of information that gets included in debug logs, set up trace flags and debug levels. The debug levels assigned to your trace flags control the type and amount of information that is logged for different events. After logging has occurred, inspect debug events in your debug logs.")
- [_Lightning Platform Tooling API Developer’s Guide_](https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_traceflag.htm)
- [_SOAP API Developer Guide_: DebuggingHeader](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_header_debuggingheader.htm)