Fetch and analyze Apex debug logs
Fetch Apex debug logs from an org with server-side filters, then parse a log into governor-limit usage, SOQL statements, exceptions and the busiest methods.
Overview
Debug Log Analyzer lets you fetch Apex debug logs with enterprise filters and parse governor limits, SOQL, method timings and exceptions — without downloading raw log files and reading them line by line.
Click any log in the list and MetaLens360 breaks it down into Governor Limits usage bars, the SOQL statements it ran, any exceptions or fatal errors, and Top Methods by Line Count so you can see where the transaction spent its effort.
Before you start
- Salesforce only records debug logs while a trace flag is active for a user. Turn on debug logging in Salesforce Setup → Debug Logs for the user you want to trace, then reproduce the activity.
- The org connection must be working. Logs are fetched live from Salesforce.
Steps
- Open Debug Log Analyzer under Monitoring, Runtime & Logs and pick the org.
- Click Filters (N) to open Server-Side Filters. These are applied in Salesforce when logs are fetched.
- Set what you need:
- Fetch Limit — 50, 100, 200 or 500 logs.
- Status and User (type to match a name).
- Operation / Endpoint — for example
/apex/MyPageorexecute-anonymous. - Start Date and End Date.
- Min Duration (ms) and Min Log Size (KB) to find the slow or heavy ones.
- Click Apply & Fetch, or Fetch Logs to fetch with the current filters.
- Click a log entry in the list to parse it.
- Review the Governor Limits bars — for example SOQL Queries against the 100 limit and SOQL Rows against 50,000.
- Review the SOQL statements, any exceptions, and Top Methods by Line Count.
Example
Priya, a release manager, hears that saving a large Opportunity on acme-uat is slow. She asks a developer to enable a trace flag for her user, reproduces the save, then sets Min Duration (ms) to 5000 and clicks Apply & Fetch. One log appears. The Governor Limits bars show 92 of 100 SOQL queries used, and Top Methods by Line Count points at OpportunityPricingService. She attaches the findings to ACME-142.
FAQs
How long are debug logs kept?
Salesforce keeps debug logs for a limited time and limits total log storage. Fetch and analyze them soon after reproducing an issue.
Can I see logs for users who are not traced?
No. Salesforce only captures logs for users with an active trace flag.
How is this different from Runtime Forensics?
Runtime Forensics summarizes many async job failures by cause. Debug Log Analyzer shows the detail of individual transactions.
Troubleshooting
"No logs found."
Read the Why there are no logs box under the message. It tells you which case applies:
- Logs exist, but none match your filters — widen the date range or clear filters.
- Trace flags are active, but nothing has been captured yet — the traced users have not run anything.
- All trace flags have expired — turn on debug logging again in Setup → Debug Logs, reproduce the activity and fetch again.
- The org has no trace flags at all — enable debug logging in Setup → Debug Logs first.
"No log capture failures found"
That is normal. Status "Failed" only happens when a log file is too large to write, which is rare.
Fetch fails with an authentication error
The org's credentials may have expired. Reconnect it from Connections and try again.
Related articles
Was this article helpful?
Related articles
- Investigate async Apex failures with Runtime ForensicsPull failed batch, queueable, future and scheduled Apex jobs from an org, grouped by root cause, with a daily trend, the classes involved and where to look for each cause.
- Analyze runtime activity with Event MonitoringLoad Salesforce Event Monitoring log files for an org to see Apex transactions, CPU time, exceptions, slow triggers, callouts and logins over the last few days.
- Fix expired org credentialsWhen an org shows Reconnect needed, Salesforce has refused its stored credentials. Re-credential it in place from the Edit dialog without losing any synced data.
- Analysis pages show no dataIf Code Intelligence, SOQL Risk, Query Amplification or other analysis pages are empty, the org usually needs a sync, an index, or a full resync. Here's how to tell which.