Checkpoints and the Developer Console Debugger
By the end of this lesson, you'll be able to:
- Set a checkpoint on a specific line of Apex code
- Inspect variable values at a checkpoint without adding System.debug statements
- Explain when a checkpoint is more efficient than reading a full debug log
Prerequisites: "Reading a Debug Log Under Pressure"
The problem checkpoints solve
public void beforeInsert(List<Opportunity> newOpportunities) {
for (Opportunity opp : newOpportunities) {
System.debug('opp.Amount: ' + opp.Amount); // added just to debug
System.debug('opp.StageName: ' + opp.StageName); // added just to debug
// ... actual logic ...
}
}
Adding several System.debug() statements purely to inspect variable state, running the code, reading the log, then removing them again is a slow, repetitive cycle for a simple question: "what were the actual values at this point?"
Setting a checkpoint
In the Developer Console's code editor, clicking in the line-number gutter next to a specific line sets a checkpoint — when code execution reaches that line (during a subsequent debug session), execution pauses there automatically, and every variable currently in scope (opp, newOpportunities, any local variable) can be inspected directly, with its exact current value, no System.debug() statements needed at all.
When a checkpoint beats a debug log
A checkpoint is the faster tool specifically when you know where the problem likely is but need to see what the data actually looked like at that exact moment — inspecting live state directly, rather than adding debug statements, running the transaction, and re-reading a log, one iteration at a time. A full debug log remains the better tool when you don't yet know where the problem is and need the complete execution trace to narrow it down first.
Exercise
As a comment, explain when a checkpoint is the more efficient debugging tool compared to adding System.debug statements.
Show hint
Think about how many iterations each approach takes to answer "what was the value here?"
Checkpoints and the Developer Console Debugger Quiz
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 checkpoint pauses execution at a specific line and lets you inspect every variable's actual value at that moment — no need to add, run, then remove a dozen System.debug statements to answer the same question.