DEV Community

Quantoknack Training
Quantoknack Training

Posted on

How can you use the “Execution Log” tab to identify issues in an Apex class?

The “Execution Log” tab in the Salesforce Developer Console is a powerful tool that helps developers trace and debug Apex class behaviour during runtime. When an Apex class is executed—whether through a trigger, anonymous window, or test class—the system logs every operation it performs. This detailed log appears in the Execution Log tab and provides a chronological breakdown of system events, which is essential for identifying performance issues, logic errors, or unexpected behaviours in your code.

To identify issues using the Execution Log:

**Open the Developer Console: **Navigate to the Developer Console from the Salesforce setup menu or user dropdown.

Enable Debug Logs: Make sure debug logging is turned on for the user executing the class, with an appropriate log level (e.g., Apex Code, System, Database set to DEBUG).

Run the Apex Code: Execute the desired Apex class or trigger (this could be through an anonymous block, test class, or system event).

Review the Log: Once the execution completes, open the corresponding log file in the Developer Console. The Execution Log tab will show a sequence of events such as:

Method entry/exit

SOQL/SOSL queries

DML operations

System.debug statements

Exceptions or errors

Filter for Clarity: Use the filter panel at the top to narrow down to specific event types like Checkpoints, SOQL Executions, or User Debug to quickly locate problem areas.

Trace Code Path: Look for signs of inefficiency or errors such as:

Too many SOQL or DML statements, which may trigger governor limits

Unhandled exceptions or null pointer errors

Long-running loops or recursive logic

*Unexpected values in debug statements
*

By carefully reading through the execution log and paying attention to these markers, developers can pinpoint the root cause of issues and take corrective actions. Regular use of the Execution Log promotes better debugging practices and helps maintain healthy, optimized Apex code.

for more details , you can take reference of salesforce developer training

Top comments (0)