Sub topic 13
Developer tools reachable from Setup
This chapter assumes you can open Setup from the gear icon, use Quick Find, and read the Setup menu categories covered earlier. It also assumes you have a Developer Edition org or a sandbox. Do not practice on production.
Setup is mostly a configuration area, but it also holds the tools you use to write, test, deploy, and debug code. They are spread across several menu categories, and a few sit outside the Setup menu. Knowing where each one lives saves time when something fails and you need a log right away.
Where the developer tools live
Most developer pages sit under three Setup categories. The category names vary slightly between releases, so use Quick Find when the menu does not match what you expect.
- Custom Code (under Platform Tools) holds Apex Classes, Apex Triggers, Apex Test Execution, Visualforce Pages, Visualforce Components, and Lightning Components.
- Environments holds Sandboxes, Logs, Jobs, and Deploy pages such as Deployment Status and Change Sets.
- Integrations holds API, where you download WSDL files, and tools for connecting outside systems.
The Developer Console is the exception. It does not appear as a regular Setup page. You open it from the gear icon menu, in the same place as Setup.
A quick reference
| Tool | Quick Find term | Typical use |
|---|---|---|
| Apex Classes | Apex Classes | List classes, check API version and status, view code |
| Apex Triggers | Apex Triggers | See which triggers exist on which objects |
| Apex Test Execution | Apex Test Execution | Select and run test classes, view results |
| Debug Logs | Debug Logs | Create trace flags and read log output |
| Apex Jobs | Apex Jobs | Monitor batch, queueable, and scheduled Apex |
| Deployment Status | Deployment Status | Check in-progress and recent deployments |
| Sandboxes | Sandboxes | Create, refresh, and open sandboxes |
| API | API | Download the Enterprise or Partner WSDL |
| Dev Hub | Dev Hub | Enable scratch orgs and second-generation packaging |
Developer Console
The Developer Console is a browser-based tool for quick work. Open it from the gear icon menu. It opens in a separate window, so allow pop-ups for your org's domain if nothing appears.
Use it for these tasks:
- Running a snippet of Apex with Debug > Open Execute Anonymous Window.
- Running SOQL in the Query Editor.
- Reading debug logs with the log inspector and its execution tree.
- Running Apex tests and viewing code coverage.
It works well for short investigations. For sustained development, most teams use Visual Studio Code with the Salesforce extensions and the Salesforce CLI, because those tools work with source control. The Developer Console edits code directly in the org, which is the opposite of that workflow.
The Developer Console needs the API Enabled permission. Creating or editing Apex also requires Author Apex. A user with Setup access can still be blocked if their profile or permission sets lack these.
Debug Logs
A debug log records what happens during a transaction: Apex execution, SOQL queries, DML, flows, validation rules, and callouts. Salesforce does not record logs for every user all the time. You turn tracing on with a trace flag.
To start tracing a user:
- In Setup, search for Debug Logs in Quick Find.
- Choose New in the Monitored Users section.
- Select the user and set the start and expiration times.
- Select or create a debug level, which sets how much detail each category logs.
- Reproduce the problem, then reload the page and open the new log.
Keep these limits in mind when logs do not appear:
- A trace flag expires. When it does, logging stops and no error tells you so.
- Each log is limited to 20 MB, and the platform truncates anything beyond that. Lower the debug level for noisy categories to avoid hitting the limit.
- Logs are kept for a short time, about 24 hours.
- If the org's total log volume gets too high, Salesforce can disable tracing. Delete old logs and set a new trace flag.
Viewing and managing debug logs normally requires View All Data. If the Debug Logs page is missing or empty for a user you expect to have access, check that permission first.
Apex Jobs and Apex Test Execution
Apex Jobs lists asynchronous work: batch Apex, queueable jobs, future methods, and scheduled Apex. Check it when a nightly process seems not to have run. The Status column shows values such as Queued, Processing, Completed, and Failed, and a failed batch shows the first error. Use Scheduled Jobs for a list of scheduled work and its next run time.
Apex Test Execution lets you pick test classes and run them in the org. Results are stored, so you can compare runs. Deployments to production run tests as well, so this page is a quick way to find failures before a deployment does.
Sandboxes and deployment pages
Under Environments, Sandboxes shows each sandbox, its type (Developer, Developer Pro, Partial Copy, or Full), its status, and its refresh options. Creating a sandbox copies production metadata, and depending on the type, some or all data. Sandboxes you create from production inherit its Setup configuration at the time of the copy. Later changes in one org do not appear in the other unless you move them with a deployment.
Under Environments > Deploy you will find:
- Deployment Status, which shows in-progress and past deployments, including component errors and test failures.
- Inbound Change Sets and Outbound Change Sets, the point-and-click way to move metadata between related orgs.
When a deployment fails, Deployment Status is where you read the specific component errors. Deployments started from the CLI or an IDE appear here too, since they use the same Metadata API.
Dev Hub and the API page
Scratch orgs, which are short-lived orgs created from source, need a Dev Hub. You enable it in Setup by searching for Dev Hub and turning on the toggle. You cannot turn it off afterward, so enable it in an org you intend to use for that purpose, usually a Developer Edition org or production, not a sandbox.
The API page under Integrations offers WSDL downloads for the SOAP API. Most new integrations use REST instead, which has no WSDL, so you may never need this page. It matters when you maintain an older SOAP integration.
Direct URLs and the CLI
Each of these tools has a Lightning Experience path, just like the pages in the earlier chapter on direct URLs. Append them to your org's domain.
/lightning/setup/ApexDebugLogs/home
/lightning/setup/ApexClasses/home
/lightning/setup/AsyncApexJobs/home
/lightning/setup/DeployStatus/home
/lightning/setup/DataManagementCreateTestInstance/homeThe path names can change between releases. If one returns an error, find the page through Quick Find and copy the URL from your browser.
The Salesforce CLI opens any of these directly and can handle logs without the browser:
# Open Debug Logs in your default org
sf org open --path lightning/setup/ApexDebugLogs/home
# List the most recent debug logs
sf apex list log
# Print the latest log
sf apex get log --number 1
# Stream new log lines as they are written
sf apex tail log --color
# Inspect trace flags through the Tooling API
sf data query --use-tooling-api --query "SELECT Id, LogType, StartDate, ExpirationDate FROM TraceFlag"The last command is a good check when logs are missing. If ExpirationDate is in the past, the trace flag has lapsed.
Common errors
- "I can't find Developer Console." It is in the gear menu, not in Setup. Also check that your browser is not blocking its pop-up window.
- "The page is not in my Setup menu." The user lacks a permission, or the feature is not available in that edition. Check Author Apex, View All Data, and API Enabled before assuming the page was removed.
- "My log is empty or missing." The trace flag has expired, the user is not the one running the transaction, or the log exceeded the size limit.
- "The org shows different code than my sandbox." Sandboxes diverge from production after the copy. Compare them through a deployment, not by assuming they match.
Exercise
A teammate says a nightly batch job did not run and no debug log exists for it. Name two Setup pages you would check, and say what each tells you.
Show answer
Check Apex Jobs (or Scheduled Jobs) to see whether the job was queued, ran, or failed, and to read the failure message. Then check Debug Logs to see whether a trace flag existed for the user running the job. Without an active trace flag, no log is recorded, so a missing log does not prove the job did not run.
Exercise
You enabled a trace flag yesterday and today no new logs appear for that user. Give the most likely cause and one CLI command that confirms it.
Show answer
The trace flag has most likely expired. Run sf data query --use-tooling-api --query "SELECT Id, LogType, StartDate, ExpirationDate FROM TraceFlag" and check whether ExpirationDate is in the past. Then create a new trace flag with a later expiration.
Exercise
Where do you open the Developer Console, and which two permissions does it commonly depend on?
Show answer
Open it from the gear icon menu, not from the Setup menu. It depends on API Enabled, and creating or editing Apex also requires Author Apex.