When something goes wrong in Salesforce, finding the exact reason can be challenging. A record may fail to save, a Flow may stop unexpectedly, an Apex trigger may produce an error, or an integration may not return the expected response.
Salesforce Debug Logs help administrators and developers understand what happens during a transaction. They record execution details, automation activity, database operations, and errors, making it easier to identify the source of a problem.
In this guide, you will learn how to enable debug logs, configure trace flags, understand log levels, read important log events, and use practical techniques to troubleshoot Salesforce issues.
What Are Salesforce Debug Logs?
Salesforce Debug Logs are records of events generated while Salesforce processes a transaction or executes Apex code and automated processes.
Depending on the configured debug level, a log can capture information about:
- Apex classes and triggers
- Salesforce Flow and workflow execution
- Database operations and SOQL queries
- Validation rules
- HTTP callouts and integrations
- System methods and execution limits
For example, suppose a sales representative cannot create an Account record. A debug log can help identify whether a validation rule, trigger, Flow, or another process caused the failure.
Debug logs are useful for both administrators investigating automation problems and developers diagnosing code-related errors.
Why Are Debug Logs Important?
Salesforce organizations often contain multiple automations, custom objects, validation rules, and integrations. When several processes run during one transaction, identifying the actual cause of an issue can take time.
Debug logs help by providing:
Better error identification: Find the event or operation that caused a transaction to fail.
Automation visibility: Understand which Apex triggers, Flows, and other processes executed.
Performance analysis: Review execution time, database activity, and resource usage.
Integration troubleshooting: Inspect callout activity and available request-response details.
Improved debugging: Understand the sequence of events instead of guessing which component caused the issue.
If your organization also needs to improve its overall performance, read our guide on Salesforce Org Optimization for Performance.
How to Enable Salesforce Debug Logs
You can create debug logs through Salesforce Setup. Follow these steps:
- Open Salesforce and navigate to Setup.
- Enter Debug Logs in the Quick Find box.
- Open the Debug Logs page.
- Under User Trace Flags, select New.
- Choose the entity you want to monitor, such as a specific user or Automated Process.
- Set the start time and expiration time.
- Select an existing Debug Level or create a new one.
- Save the trace flag.
- Reproduce the issue in Salesforce.
- Return to Debug Logs and open the newly generated log.
A trace flag determines whose activity or which execution context Salesforce monitors and for how long. The debug level determines how much detail the log captures.

Understanding Salesforce Debug Log Levels
Debug levels control the amount of information recorded in each log category. Salesforce provides the following levels:
| Debug Level | What It Captures |
|---|---|
| None | No information for the category |
| Error | Errors and failures |
| Warn | Warning messages and relevant events |
| Info | General informational events |
| Debug | Debugging details |
| Fine | More detailed execution information |
| Finer | Highly detailed information |
| Finest | The most detailed available information |
The available options can vary by category. Higher verbosity generally produces more information and can make logs larger.
For example, if you are investigating an Apex trigger, you may need a higher Apex Code logging level. If the issue involves a Flow, pay attention to Workflow-related logging.
Important Debug Log Categories
| Category | Purpose |
|---|---|
| Apex Code | Tracks Apex execution, triggers, and methods |
| Database | Records database operations |
| Workflow | Captures Flow and workflow-related activity |
| Validation | Helps identify validation rule evaluations |
| Callout | Records external service callout activity |
| Apex Profiling | Provides performance and resource information |
| System | Captures system method activity |
| Visualforce | Records Visualforce-related execution |
Choose categories based on the problem you are investigating instead of setting every category to the highest level.
How to Read and Analyze Salesforce Debug Logs
A debug log contains multiple event entries. Each entry provides information about a particular activity during transaction execution.
For example, when troubleshooting a validation rule, you may find entries such as:
VALIDATION_RULE
VALIDATION_FORMULA
VALIDATION_FAIL
These entries help you understand which validation rule was evaluated, the formula involved, and whether the validation failed.
Here are some useful log events to recognize:
| Log Event | What It Indicates |
|---|---|
| EXECUTION_STARTED | Execution has started |
| EXECUTION_FINISHED | Execution has completed |
| CODE_UNIT_STARTED | An Apex code unit has started |
| CODE_UNIT_FINISHED | An Apex code unit has finished |
| SOQL_EXECUTE_BEGIN | A SOQL query is beginning |
| SOQL_EXECUTE_END | A SOQL query has completed |
| DML_BEGIN | A database operation is beginning |
| DML_END | A database operation has completed |
| FATAL_ERROR | A serious execution error occurred |
| VALIDATION_FAIL | A validation rule failed |
To analyze a log effectively:
- Open the relevant log from Setup.
- Search for keywords such as
FATAL_ERROR,EXCEPTION, orVALIDATION_FAIL. - Check the surrounding entries to understand what happened before the error.
- Identify the Apex class, trigger, Flow, or operation involved.
- Review the related code or automation configuration.
- Reproduce the issue after making a correction.

Salesforce Debug Logs: 9 Practical Tips to Troubleshoot Errors Faster
1. Monitor the Correct User
Create trace flags for the user who is experiencing the problem. Monitoring unrelated users can generate unnecessary logs and make analysis harder.
2. Use the Right Debug Level
Do not set every category to Finest. Start with the relevant categories and increase verbosity only when more information is needed.
3. Reproduce the Issue
Generate a log while performing the exact action that causes the problem. This makes it easier to connect log events with the actual error.
4. Search for Important Error Keywords
Search for FATAL_ERROR, EXCEPTION, VALIDATION_FAIL, and other relevant event names. These can help you locate important entries quickly.
5. Check Apex Execution and SOQL Queries
If an Apex operation fails, review code unit events, query execution, and database operations. Also check whether the transaction is approaching governor limits. Learn more in our guide to Salesforce Governor Limits.
6. Review Flow and Automation Activity
When a Flow fails, inspect the available workflow-related events and identify the element or operation involved. For approval automation, see our guide to Flow Approvals in Salesforce Flow Builder.
7. Download Large Logs
If a log is difficult to review in the browser, download it and use a text editor to search, filter, and examine relevant entries.
8. Keep Trace Flags Short and Relevant
Trace flags should remain active only while you are troubleshooting. Remove or update unnecessary flags to reduce excessive log generation.
9. Verify the Fix
After correcting the issue, reproduce the same action again. Confirm that the error no longer appears and that the expected business process completes successfully.
Common Salesforce Debug Log Problems and Their Solutions
| Problem | Possible Cause | What to Check |
|---|---|---|
| No logs generated | Missing or expired trace flag | Check the traced entity and time window |
| Logs are too large | Excessive logging detail | Reduce unnecessary debug levels |
| Flow failure | Incorrect configuration or failed element | Review Flow execution details |
| Apex exception | Code or runtime issue | Search for exception and fatal error entries |
| Integration failure | Callout or authentication problem | Review callout details and integration configuration |
| Log is difficult to read | Too many unrelated events | Filter by relevant event names and categories |
For integration-related problems, our Salesforce API Integration Guide explains important integration concepts and implementation considerations.
Salesforce Debug Log Limits You Should Know
Debug logs have limits that administrators and developers should consider.
Based on the Salesforce information included in the reviewed search results:
- Individual log size: A debug log can be up to 20 MB. Older lines may be removed when the limit is exceeded.
- Retention: System logs are retained for 24 hours, while monitoring logs are retained for seven days, according to the cited search summary.
- Org log generation: The search summary reports a 1,000 MB log-generation threshold within 15 minutes, which can affect trace flags and log generation.
These limits and behaviors can depend on Salesforce’s current platform rules. Check the latest official documentation before using them for production monitoring or capacity planning.
For more information, refer to the Salesforce Debug Logs documentation.
Frequently Asked Questions
1. Where can I find Salesforce Debug Logs?
Go to Setup, enter Debug Logs in Quick Find, and open the Debug Logs page. You can view, download, or delete available logs from there.
2. How do I enable debug logs for a specific user?
Open Setup → Debug Logs, create a new User Trace Flag, select the user, configure the time window, and attach a Debug Level.
3. Why are Salesforce Debug Logs not generating?
Check whether the correct user or execution context has an active trace flag. Also verify its expiration time and reproduce the action while monitoring is active.
4. Can I use debug logs to troubleshoot Salesforce Flows?
Yes. Debug logs can provide workflow-related execution details. For more detailed Flow troubleshooting, you can also use Flow Builder’s debugging and error information.
5. How do I reduce the size of Salesforce Debug Logs?
Monitor only the required users, select relevant categories, reduce unnecessary logging verbosity, and avoid keeping trace flags active longer than needed.
6. Can I download Salesforce Debug Logs?
Yes. From the Debug Logs page, use the available download option to save a log as a text file for further analysis.
Conclusion
Salesforce Debug Logs are an important troubleshooting resource for administrators and developers. They help reveal how Salesforce processes transactions, executes automation, handles database operations, and reports errors.
By configuring trace flags correctly, choosing suitable debug levels, and understanding important log events, you can identify problems faster and avoid unnecessary troubleshooting time.
The key is to monitor the right execution context, focus on relevant log information, and verify every fix by reproducing the original issue. With regular practice, debugging becomes a more structured and reliable part of Salesforce development and administration.

