Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Full Debug Log entry
How-to guide

How to capture a debug log for a specific user or transaction

Debug logs require a Trace Flag and a Debug Level. Once both are in place, any transaction the targeted user runs (or any transaction that touches the targeted entity) produces a log. The fastest path is through the Developer Console; production-grade debugging uses the Setup UI or the Tooling API.

By Dipojjal Chakrabarti · Founder & Editor, Salesforce DictionaryLast updated May 20, 2026

Debug logs require a Trace Flag and a Debug Level. Once both are in place, any transaction the targeted user runs (or any transaction that touches the targeted entity) produces a log. The fastest path is through the Developer Console; production-grade debugging uses the Setup UI or the Tooling API.

  1. Open Setup, then Debug Logs

    Setup, then Debug Logs. The page lists active Trace Flags and recent logs. Click New to add a Trace Flag.

  2. Pick the target user

    For most debugging, set the Tracked Entity Type to User and the Tracked Entity Name to your own user. For multi-user troubleshooting, target the user who is hitting the bug.

  3. Pick or create a Debug Level

    Choose an existing Debug Level (SFDC_DevConsole is a good default) or create a new one with the categories and levels you want. APEX_CODE: FINE and DB: FINEST are common starting points; raise individual categories as needed.

  4. Set the start and expiration time

    Trace Flags expire automatically. Default duration is 30 minutes; max is 24 hours. Pick a window that covers your testing without burning storage.

  5. Reproduce the transaction

    Run the failing process: hit a button, save a record, run an Apex job. Each transaction the user runs in the window produces a new log entry.

  6. Open and analyze the log

    From the Debug Logs page or the Developer Console (Debug, then View Log), open the log. Search for USER_DEBUG, EXCEPTION_THROWN, or CUMULATIVE_LIMIT_USAGE to jump to the interesting parts. Download the file if you need to grep it offline.

Key options
User Trace Flagremember

Logs every transaction the user runs. Most common starting point for general debugging.

Apex Class Trace Flagremember

Logs only transactions that execute the named Apex class. Useful for narrowing high-volume logs to one component.

Apex Trigger Trace Flagremember

Logs only transactions that fire the named trigger.

APEX_CODE categoryremember

Controls Apex execution detail. FINE shows method entry/exit; FINEST adds variable values and SOQL bind details.

DB categoryremember

Controls SOQL and DML detail. FINEST shows query plans and row counts.

Gotchas
  • Logs are capped at 50 MB each. A FINEST log on a batch with 200 records can hit the cap and lose the start of the transaction. Lower the level or narrow the trace flag to a specific class.
  • User Trace Flags expire automatically. If you opened a 30-minute window and the failing transaction runs at minute 31, you get no log. Check the expiration before reproducing.
  • The 250 MB rolling org-wide cap is shared across all users. A noisy demo org with multiple developers logging at FINEST can suppress new logs until older ones age out.
  • Logs are stored for 7 days. Anything older is gone. Download or query into Apex what you need to preserve before that window closes.

See the full Debug Log entry

Debug Log includes the definition, worked example, deep dive, related terms, and a quiz.