Intermediate 20 min read

Debug Log Levels

By the end of this lesson, you'll be able to:

  • Explain what a debug log level controls
  • Set an appropriate log level for a specific debugging need
  • Recognize why "everything at maximum verbosity" is often the wrong default

Prerequisites: Module 32: "Project: Loan Processing"

What a log level actually controls

Every System.debug(...) statement this course has used since Module 1 writes to a debug log — but a debug log is really several independent categories (Apex Code, Database, Validation, Workflow, and more), each with its own verbosity level: NONE, ERROR, WARN, INFO, DEBUG, FINE, FINER, FINEST. Setting Apex Code to FINEST captures every single line executed; setting it to ERROR captures almost nothing except actual errors.

Choosing the right level for the task

Debugging a specific System.debug() statement's output only needs the Apex Code category at DEBUG level or above — not maximum verbosity across every category. Debugging exactly which SOQL queries ran and how long they took needs the Database category raised specifically. Tracing execution line-by-line (rare, and usually a last resort) needs FINEST.

Why "maximum everything" is usually the wrong default

Setting every category to FINEST produces an enormous log — often truncated by Salesforce\'s log size limit before it even reaches the part you actually needed, and genuinely painful to read through manually. Choosing a log level deliberately, based on what you\'re actually trying to see, is the first habit that separates efficient debugging from scrolling through thousands of irrelevant lines.

Exercise

As a comment, explain which category and level you would raise to see exactly which SOQL queries ran during a transaction, and why not just set everything to FINEST.

Show hint

Think about what "everything at FINEST" costs versus what you actually need to see.

APEX

Debug Log Levels Quiz

1. What does a debug log level control?

Log in to submit the quiz and save your score.

My Notes

Log in to keep private notes on this lesson.

Questions about this lesson

No questions yet — be the first to ask.

Log in to ask a question about this lesson.

Summary

A debug log's level controls how much detail gets captured for each category (Apex Code, Database, System, etc.) — choosing the right level for the situation is the first skill in reading logs efficiently.