You are here:
Delete Debug Logs
When your org accumulates too many debug logs, delete some or all of your system logs and monitoring logs. Use the Developer Console’s Query Editor to find and delete the logs using Tooling API.
Required Editions
| Available in: Salesforce Classic (not available in all orgs) and Lightning Experience |
| Available in: Enterprise, Performance, Unlimited, Developer, and Database.com Editions |
| User Permissions Needed | |
|---|---|
| To view, retain, and delete debug logs: | View All Data |
- 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. To sort by a column, click its header. To select
individual logs, press Ctrl (Windows or Linux) or Command (macOS). To select a block of logs,
press Shift.
LogLengthshows the size of the log in bytes.For system logs,
LocationisSystemLog. System logs are generated as part of system log monitoring, such as while you use Developer Console, and are visible only to you.For monitoring logs,
LocationisMonitoring. Monitoring logs are generated when your org has activeCLASS_TRACINGorUSER_DEBUGtrace flags. These logs are visible to all your org’s admins.- Each debug log must be 20 MB or smaller. Debug logs that are larger than 20 MB are reduced
in size by removing older log lines, such as log lines for earlier
System.debugstatements. 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. We send an email to the users who last modified the trace flags, informing them
that they can re-enable the trace flag in 15 minutes.
Warning If the debug log trace flag is enabled on a frequently accessed Apex class or for a user executing requests often, the request can result in failure, regardless of the time window and the size of the debug logs. - When your org accumulates more than 1,000 MB of debug logs, we prevent users in the org from adding or editing trace flags. To add or edit trace flags so that you can generate more logs after you reach the limit, delete some debug logs.
- Each debug log must be 20 MB or smaller. Debug logs that are larger than 20 MB are reduced
in size by removing older log lines, such as log lines for earlier
- Click Delete Row.
- To confirm the log deletion, click Yes.
Did this article solve your issue?
Let us know so we can improve!

