Loading
Enhance Salesforce with Code
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Delete Debug Logs

          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
          1. Open Developer Console.
          2. At the bottom of the console, select the Query Editor tab.
          3. Select Use Tooling API.
          4. Enter this SOQL query:
            SELECT Id, StartTime, LogUserId, LogLength, Location FROM ApexLog
          5. Click Execute.
          6. 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.

            LogLength shows the size of the log in bytes.

            For system logs, Location is SystemLog. 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, Location is Monitoring. Monitoring logs are generated when your org has active CLASS_TRACING or USER_DEBUG trace 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.debug statements. 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
              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.
          7. Click Delete Row.
          8. To confirm the log deletion, click Yes.
           
          Loading
          Salesforce Help | Article