Sub topic 13
Developer tools reachable from Setup
This chapter assumes you can open Setup, use Quick Find, and read the Setup menu categories from the earlier chapters. You also need an org where you can create or edit code, such as a Developer Edition org or a sandbox.
Setup is mainly for configuration, but it also links to the places where developers inspect and test an org. These tools are spread across the menu, so it helps to know where each one is.
Where the tools live
| Tool | How to reach it | Used for |
|---|---|---|
| Developer Console | Gear icon, then Developer Console | Running anonymous Apex, reading logs, running tests |
| Debug Logs | Quick Find: "Debug Logs" | Choosing which user's activity is recorded |
| Apex Classes and Triggers | Quick Find: "Apex Classes" or "Apex Triggers" | Listing code, checking status, running tests |
| Apex Jobs | Quick Find: "Apex Jobs" | Watching batch and queued jobs |
| Sandboxes | Quick Find: "Sandboxes" | Creating and refreshing test environments |
The Developer Console is the exception. It sits in the gear menu next to Setup, not inside the Setup tree.
Debug Logs
A debug log records what happened while a user ran code or a flow. It shows SOQL queries, DML operations, and errors. Salesforce only writes a log when a trace flag exists for the user, so the first step is to create one.
- In Setup, search for Debug Logs in Quick Find.
- Click New in the Monitored Users list.
- Choose the user, set the start and expiration times, and pick a debug level.
- Reproduce the problem as that user, then reload the page and open the new log.
Trace flags expire, and old logs are deleted automatically once the log storage limit is reached. Save a log you want to keep.
You can open the same page directly from the CLI, using the URL pattern from the previous chapter:
sf org open --path lightning/setup/ApexDebugLogs/homeTo stream logs into your terminal instead, run this in a project connected to the org:
sf apex tail log --colorReading code from Setup
Apex Classes lists every class in the org, with its API version and whether it is valid. Apex Triggers does the same for triggers. In both lists you can see the code and run tests, but editing in a production org is blocked. Make code changes in a sandbox or scratch org and deploy them.
Apex Jobs is the page to check when a batch job seems stuck. It shows each job's status, the number of batches processed, and any error count.
Sandboxes
Sandboxes are under Environments in the Setup menu. This page lists existing sandboxes, their type, and their refresh status. It is also where you create a new one. Sandbox creation is only available in a production org, not inside another sandbox.
Permissions
Setup access alone does not unlock these tools. Common requirements are:
- Developer Console: the API Enabled permission, plus View All Data for most uses.
- Debug Logs: View All Data to view and delete logs.
- Running anonymous Apex: Author Apex.
If a page is missing from Quick Find, a missing permission is the likeliest cause. Ask an administrator to check your profile and permission sets.
Common errors
- No log appears. The trace flag expired, or it was created for a different user than the one who ran the action.
- The log is cut off. A single log has a size limit. Lower the debug levels for categories you do not need.
- Apex Classes shows no Edit link. You are in production. Use a sandbox.
Exercise
You created a trace flag for a user, but after they reproduce an error, Debug Logs is empty. Name two things to check.
Show answer
Check that the trace flag has not expired, and that it was created for the same user who ran the action. Also confirm that you have View All Data so you can see the logs.
Exercise
Why can't you edit an Apex class from the Apex Classes page in a production org, and where should you make the change?
Show answer
Production orgs block direct code edits. Make the change in a sandbox or scratch org, then deploy it to production.