The Developer Console can help with many of your development tasks.
Available in: Salesforce Classic and Lightning Experience
Available in: Enterprise, Performance, Unlimited, Developer, and Database.com Editions
User Permissions Needed
To use the Developer Console:
“View All Data”
To execute anonymous Apex:
To use code search and run SOQL or SOSL on the query tab:
To save changes to Apex classes and triggers:
To save changes to Visualforce pages and components:
To save changes to Lightning resources:
How Do You Use the Developer Console?
Debugging and Troubleshooting
The Developer Console provides a convenient set of tools for efficiently tracking down logical issues.
View Logs: Use the Logs tab to view a list of logs. Open logs in the Log Inspector. Log Inspector is a context-sensitive execution viewer that shows the source of an operation, what triggered the operation, and what occurred afterward. Use this tool to inspect debug logs that include database events, Apex processing, workflow, and validation logic.
Set and View Checkpoints in Apex Code: Use the Developer Console to set checkpoints to identify the source of errors. For example, if you want to understand why a certain request generates an error, you can review the execution, identify the offending logic, and set a checkpoint. When you execute the process again, you can inspect the request at that specific point to understand in detail how to improve your code. While the Developer Console can't pause execution like a traditional debugger, it provides cloud developers much of the same visibility, and reduces the need to instrument code with System.debug commands.
Editing and Navigating Source Code
The Developer Console allows you to browse, open, edit and create source code files.
Browse Packages in Your Organization: Navigate the contents of packages created in your organization.
View and Edit Apex Classes and Triggers: Open and edit Apex triggers and classes, and open a read-only view of your custom object definitions.
View and Edit Lightning Components: Open and edit Lightning resources, such as an application, component, event, or interface.
View and Edit Visualforce Pages and Components: Open and edit Visualforce pages and components.
Use the Source Code Editor: Open a working set of code files and switch between them with a single click. The Developer Console Source Code Editor includes an auto-complete feature for Apex code.
Testing and Validating Performance
The Developer Console has a number of features dedicated to testing code and analyzing performance.
Test Apex Code: Use the Developer Console to check code coverage and run Apex tests, including unit tests, functional tests, regression tests, and so on. To facilitate the development of robust, error-free code, Apex supports the creation and execution of unit tests. Unit tests are class methods that verify whether a particular piece of code is working properly. Unit test methods take no arguments, commit no data to the database, send no emails, and are flagged with the testMethod keyword or the isTest annotation in the method definition. Also, test methods must be defined in test classes, that is, classes annotated with isTest.
Inspect Logs for Performance Issues: Log Inspector is a context-sensitive execution viewer that shows the source of an operation, what triggered the operation, and what occurred afterward. Use this tool to inspect debug logs that include database events, Apex processing, workflow, and validation logic. Open a debug log and view the aggregated performance of an operation in the Performance Tree. The Executed Units panel breaks up the request both by time and type, and categorizes the timings by methods, queries, workflows, callouts, DML, validations, triggers, and pages, giving you a clear idea of where to find performance issues. Use the Timeline panel to see a timeline view of the overall request and walk through the events for a given block. The Limits panel provides a summary view of resources used and maps them against your allocated request limits.
Executing SOQL and SOSL Queries
The Developer Console provides a simple interface for managing SOQL and SOSL queries.
Edit and Execute SOQL and SOSL Queries: Use the Query Editor to query data from your organization.
View Query Results: Results are displayed in a Query Results grid, in which you can open, create, update, and delete records. For SOSL search results with multiple objects, each object is displayed on a separate tab.