Testing, Debugging, and Deployment20% of the exam

Diagnosing Apex with debug logs and Replay Debugger

Trace the right entity (user, Automated Process, class or trigger), tune log levels to beat the 20 MB truncation, read the Log Inspector and Limits output, replay logs with checkpoints, and decode DmlException rows, exception emails, AsyncApexJob errors and test-only failures.

Official exam objective
Given a scenario, Apex code, Apex trigger, or Apex tests that's not executing as expected, apply techniques tools to identify the cause.

~8 min read · 16 practice questions ·

What the exam expects

  • Choose the trace flag that captures the failing transaction: a user (including an integration user), Automated Process for event subscribers, or a class or trigger override.
  • Predict what a log contains from its debug levels, and fix logs that are truncated or too noisy.
  • Locate slow code and limit consumption with the Log Inspector and the Limits methods; inspect trigger context with Replay Debugger checkpoints.
  • Identify failing rows and jobs with DmlException methods, exception emails, AsyncApexJob and sf apex tail log.
  • Explain test-only and trigger-skipping failures: Owner relationships in data-silo tests, the standard price book, cascade deletes and mixed DML.

Key terms: trace flag (an entity, time window and debug level that turns on logging); debug level (a log level per category such as Apex Code or Database); CLASS_TRACING (a class or trigger trace flag that overrides levels but never creates logs); checkpoint (a line where Replay Debugger captures a heap dump).

This unit assumes the Platform Developer guide's Debugging with logs and monitoring async jobs and flows (trace flag basics, reading a log, Developer Console).

Key facts

CLASS_TRACING
Detail
Overrides levels; never generates logs on its own
Class flag inheritance
Detail
Called methods and triggers inherit the override unless they have their own
Event trigger logs
Detail
Created by Automated Process (or the overriding running user); not in the Developer Console Logs tab
System.debug default level
Detail
DEBUG, unless a LoggingLevel is passed
Log size
Detail
20 MB per log; older lines removed above it
Log volume
Detail
More than 1,000 MB in 15 minutes disables trace flags
Checkpoints
Detail
Up to five; expire after 30 minutes; only place trigger context variables show
Time per process
Detail
Timeline tab: milliseconds and percent of the request
Failed batch details
Detail
AsyncApexJob.NumberOfErrors and ExtendedStatus
Live logs in terminal
Detail
sf apex tail log
Sources for this section (8)
  • Why does a CLASS_TRACING flag on its own produce no log?
  • When must Replay Debugger checkpoints be uploaded?
  • Why can a 20 MB log miss `System.debug` output from early in the transaction?
  • Which `DmlException` method returns a failed row's position in the original list?
  • Which Log Inspector views show where a slow save spent its time?

The questions are free to read. Answers with their sources and self-grading are included with the pack.

Keep reading with the Platform Developer II pack

  • Core concepts
  • Exam traps
  • Worked scenario

The pack includes:

  • All 28 lessons of the Platform Developer II guide, with reading progress
  • Interactive decision walks and step-by-step sequence steppers
  • Inline practice questions and one-click topic practice (16 questions for this lesson)
  • An official source cited for every claim
  • An AI tutor that answers from the guide
  • Unlimited timed practice exams

Practice for the Platform Developer II exam