Salesforce Debug Log Levels Explained
Salesforce debug logs have eight levels — NONE, ERROR, WARN, INFO, DEBUG, FINE, FINER, FINEST — set per category (ApexCode, Database, System, Workflow, and others) in a Debug Level record. A trace flag then applies that debug level to a user, class, or automated process for a time window. Higher levels log more detail but hit the 20 MB truncation cap faster.
Trace flags vs. debug levels — the two-part system
- Debug Level — a named, reusable record (like the default
SFDC_DevConsole) that sets one level per category. - Trace Flag — applies a debug level to a target for a start/expiry window. Targets can be a user, an Apex class or trigger (class-scoped tracing), or the Automated Process entity (for logs from scheduled flows and system automation).
No active trace flag → no log at all. That's the #1 answer to "why is Salesforce not generating debug logs?" — the flag expired. (ForceLens's Smart Capture creates the flag for you; see how to read Apex debug logs.)
What each category controls
| Category | Governs | Notable events it emits |
|---|---|---|
| ApexCode | Apex execution: methods, statements, System.debug | METHOD_ENTRY/EXIT, USER_DEBUG, VARIABLE_ASSIGNMENT (FINEST) |
| ApexProfiling | Profiling summaries, cumulative stats | CUMULATIVE_LIMIT_USAGE, profiling summaries |
| Database | SOQL, SOSL, DML detail | SOQL_EXECUTE_BEGIN/END, DML_BEGIN/END |
| System | Platform internals and system methods | SYSTEM_METHOD_ENTRY/EXIT — very noisy at DEBUG+ |
| Workflow | Workflow rules, Process Builder, Flows | WF_RULE_*, FLOW_ELEMENT_BEGIN/END |
| Validation | Validation rule evaluation | VALIDATION_RULE, VALIDATION_FORMULA |
| Callout | External HTTP/SOAP requests & responses | CALLOUT_REQUEST/RESPONSE |
| Visualforce | VF page lifecycle and serialization | VF_* events |
What the levels actually mean
| Level | Rule of thumb |
|---|---|
NONE | Category is silent. |
ERROR / WARN | Only failures/warnings. Good for categories you don't care about right now. |
INFO | Key milestones — e.g. Database at INFO logs queries without row-by-row detail. |
DEBUG | The workhorse. ApexCode at DEBUG shows USER_DEBUG (your System.debug output). |
FINE / FINER | Adds method entries/exits and progressively more internal detail. |
FINEST | Everything — including variable assignments in ApexCode. Maximum insight, maximum log size. |
One subtlety: System.debug(LoggingLevel.ERROR, 'msg') tags your statement with a level, so it survives even when ApexCode is turned down — a handy trick for permanent diagnostic lines.
Recommended presets
| Task | ApexCode | Database | Workflow | System | Others |
|---|---|---|---|---|---|
| General Apex debugging | FINEST | INFO | INFO | DEBUG | INFO |
| SOQL investigation | FINE | FINEST | INFO | INFO | ERROR |
| Flow debugging | DEBUG | INFO | FINER | INFO | ERROR |
| Log keeps truncating | DEBUG | INFO | ERROR | INFO | NONE/ERROR |
| Performance / CPU | FINE | INFO | INFO | INFO | ApexProfiling: FINE |
Beating the 20 MB truncation cap
When a log exceeds 20 MB, Salesforce drops lines and stamps *** Skipped markers — often exactly where your bug was. In order of effectiveness:
- Silence the noise: System → INFO, Validation/Workflow → ERROR when you don't need them.
- Scope to a class: add a class-level trace flag (ForceLens's Advanced Capture does this) so only that class logs at FINEST while the user-level flag stays modest.
- Shrink the transaction: reproduce with 1 record instead of 200 where the bug allows.
Whatever levels you pick, the output is still a wall of text — a debug log analyzer like ForceLens turns it into an execution tree, SOQL/DML tabs and a limits dashboard, whatever the verbosity.
Frequently asked questions
What are the debug log levels in Salesforce?
NONE, ERROR, WARN, INFO, DEBUG, FINE, FINER, FINEST — set per category in a Debug Level record, applied by a trace flag.
What's the difference between a trace flag and a debug level?
The debug level defines verbosity per category; the trace flag applies it to a user, class, or automated process for a time window. Without an active trace flag, nothing logs.
Which level shows System.debug output?
ApexCode at DEBUG or higher — unless you tag the statement with an explicit level like LoggingLevel.ERROR, which shows even at lower settings.
How do I stop log truncation?
Lower noisy categories (System, Validation, Workflow), scope high-detail tracing to a single class, or shrink the reproducing transaction. The 20 MB cap itself can't be raised.
Set levels in one click
ForceLens's Smart Capture and Advanced Capture create the trace flag with sensible levels for you — then open the captured log analyzed. Free and local.