Newer Version Available

This content describes an older version of this product. View Latest

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.
The order of precedence for debug log levels is:
  1. Trace flags set in the Developer Console 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.
    1. To access your trace flags and their expiration times, open the Developer Console and click Debug | Change Log Levels.
    2. To add trace flags for a class or trigger, click Add, select a class or trigger, and then click Add.
    3. To adjust your log levels, double-click fields.

    Setting trace flags doesn’t cause logs to be generated or saved. Trace flags override other logging levels, 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.

    Note

  2. 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
  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 you enable system logs for a user, you get debug logs for that user’s next 20 requests.
  5. 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.