
- Select Debug | Open Execute Anonymous Window.
- The Enter Apex Code window displays the last code that you entered for execution. If it’s different from the following code, delete it and paste the ...
- Select the Open Log option.
- Click Execute.
Full Answer
How do I view the execution log in Salesforce?
You can view your log in two ways. Before execution, enable Open Log in the Enter Apex Code window. The log opens after your code has been executed. After execution, double-click the log that appears in the Logs tab. Let’s try the first method. Select Debug | Open Execute Anonymous Window.
What are debug logs in Salesforce?
Apex debug logs can record database operations, system processes, and errors that occur when executing a transaction or running unit tests in any authenticated org. Enable the Debug Log in Salesforce Extensions for VS Code, then view the logs with VS Code or Salesforce CLI.
How do I generate a log in Salesforce apex?
To generate a log, let’s execute the EmailMissionSpecialist Apex class that you created earlier. You can view your log in two ways. Before execution, enable Open Log in the Enter Apex Code window. The log opens after your code has been executed.
How can I see the elapsed time in execution logs?
The elapsed time value is excluded from logs reviewed in the Developer Console when you use the Execution Log view. However, you can see the elapsed time when you use the Raw Log view. To open the Raw Log view, from the Developer Console’s Logs tab, right-click the name of a log and select Open Raw Log.

How do I read Salesforce logs?
To view the debug logs, from the setup option in Salesforce, enter 'Debug Logs' in the 'Quick Find box', then select 'Debug Logs'. Once you select the Debug Logs, click the 'View' button to examine the log. Click 'Download' to download the logs as an XML file.
How do I query logs in Salesforce?
Query Event Log Files in Developer ConsoleClick File | Open.Under Entity Types, select Objects.In the Filter the repository field, type EventLogFile .Select EventLogFile under Entities.Click Open.
What information can the log inspector contain?
The Log Inspector is a context-sensitive execution viewer in the Developer Console. It shows the source of an operation, what triggered the operation, and what occurred next. Use this tool to inspect debug logs that include database events, Apex processing, workflow, and validation logic.
How do you trace DML statements executed in debug logs?
Tracking DML in a Request In the Execution Log panel, select Filter, then type DML . All items in the request that contain DML anywhere in either the event or details display. In the Execution Overview panel, click the Executed Units tab and disable all other types of execution, except for DML.
How do I query debug logs?
Open Developer Console.At the bottom of the console, select the Query Editor tab.Select Use Tooling API.Enter this SOQL query: SELECT Id, StartTime, LogUserId, LogLength, Location FROM ApexLog.Click Execute.Select the logs you want to delete. ... Click Delete Row.To confirm the log deletion, click Yes.
What are event logs in Salesforce?
An event log file is generated when an event occurs in your organization and is available to view and download after 24 hours. The event types you can access and how long the files remain available depends on your Salesforce edition.
How do I debug in Salesforce?
Use the Log InspectorFrom Setup, select Your Name > Developer Console to open Developer Console.Select Debug > Change Log Levels.Click the Add/Change link in General Trace Setting for You.Select INFO as the debug level for all columns.Click Done.Click Done.Select Debug > Perspective Manager.More items...
What is a debug log?
A debug log can record database operations, system processes, and errors that occur when executing a transaction or running unit tests. Debug logs can contain information about: Database changes.
How do I get Apex job logs in Salesforce?
To see all Apex batch classes, click the link at the top of the page to go to the batch jobs page. Click More Info on a particular batch class to show the parent jobs of the batch class, including information about: Status.
How do I trace Apex code execution SalesForce?
Use checkpoints, logs, and the View State tab to help debug the code you've written.Set Checkpoints in Apex Code. Use Developer Console checkpoints to debug your Apex classes and triggers. ... Overlaying Apex Code and SOQL Statements. ... Checkpoint Inspector. ... Log Inspector. ... Use Custom Perspectives in the Log Inspector. ... Debug Logs.
How do I read Apex debug logs?
To view a debug log, from Setup, enter Debug Logs in the Quick Find box, then select Debug Logs. Then click View next to the debug log that you want to examine.
How do I trace an Apex class in SalesForce?
For class-based trace flags, enter Apex Classes in the Quick Find box, click Apex Classes, click the name of a class, then click Trace Flags. For trigger-based trace flags, enter Apex Triggers in the Quick Find box, click Apex Triggers, click the name of a trigger, then click Trace Flags.
Stack Tree
The Stack Tree panel displays two tree views that show information “top down”—from initiating calls to the next level down—so that you can see the hierarchy of items in a process. For example, if a class calls a second class, the second class displays as a child node of the first class.
Execution Stack
The Execution Stack panel displays a “bottom-up” view of the currently selected item in the debug log, starting with the lowest level call, followed by the operation that triggered that call, and so on.
Execution Log
The Execution Log panel contains the debug log for the current process. The debug log contains every action that occurred in the process, such as method calls, workflow rules, and DML operations. To view long lines that are truncated in the view, hover over the line to display a popup.
Source
The Source panel contains the executed source code or the metadata definitions of entities used during the process, and lists how many times a line of code was executed. The content displayed in the panel depends on what's selected elsewhere in the view.
Variables
Use the Variables panel to discover when a variable is assigned a value and what that value is. Click a Variable event to populate the section.
Execution Overview: Save Order, Limits, Timeline, and Executed Units
The Execution Overview panel at the bottom of the Log Inspector contains four tabs:
Debug Log Categories
Each debug level includes a debug log level for each of the following log categories. The amount of information logged for each category depends on the log level.
Debug Log Levels
Each debug level includes one of the following log levels for each log category. The levels are listed from lowest to highest. Specific events are logged based on the combination of category and levels. Most events start being logged at the INFO level.
Debug Event Types
The following is an example of what is written to the debug log. The event is USER_DEBUG. The format is timestamp | event identifier:
What is Salesforce debug log?
Salesforce is a widely used CRM tool. It provides one integrated platform for sales, marketing, services and commerce. The Salesforce debug logs can help you to keep track of time, the status of transactions, etc. In this blog, you will learn about Salesforce debug logs, how to create it and how to use it to track issues.
How to set up debug log in Salesforce?
To set the Debug Log, click on ‘New’. Select the user, start date and expiration date (future date) to set up Debug Log.
What is a log level?
Log Levels are useful to determine the type of information logged when the workflow kicks in. Different log levels will help you to understand the process, status of the job, any internal information about code execution, etc. Below are the log levels listed from the lowest to the highest level.
How long are debug logs retained?
System debug logs are retained for 24 hours. Monitoring debug logs are retained for seven days. If you are generating more than 1000 MB of logs files in 15 minutes window, Trace flags will be disabled automatically. You will receive an email with the information so that you can analyze and re-enable it.
What is a log line?
Log lines are included inside units of code and indicate which code or rules are being executed. Log lines can also be messages written to the debug log. For example: Log lines are made up of a set of fields, delimited by a pipe ( | ).
How long are debug logs retained?
The log lines can be removed from any location, not just the start of the debug log. System debug logs are retained for 24 hours. Monitoring debug logs are retained for seven days. If you generate more than 1,000 MB of debug logs in a 15-minute window, your trace flags are disabled.
What is a debug log?
A debug log can record database operations, system processes, and errors that occur when executing a transaction or running unit tests. Debug logs can contain information about: Database changes. HTTP callouts. Apex errors.
Does debug log include time based workflows?
The debug log does not include information from actions triggered by time-based workflows. You can retain and manage debug logs for specific users, including yourself, and for classes and triggers. Setting class and trigger trace flags doesn’t cause logs to be generated or saved.
