How to mass delete Debug Logs in Salesforce?

Published by

on


Hello Ohana,

Are you frustrated with huge logs generated in Salesforce by your colleague or by you 😀 ? No worries this blog post will 100% remove your headache.

Common mistake we do while setting up the Trace Flag is we generally sets the duration more than we need and we don’t delete the Trace Flag after use. So, this continues to accumulates unnecessary debug logs. Always avoid this practice.

So basically, when your org accumulates more than 1,000 MB of debug logs, salesforce won’t allow you to add or edit trace flags. To continue, you need to delete some debug logs from your org. Now here is the actual challenge.

Suppose there are 1,500 MB of debug logs has been generated and the size of each file is very small. In this case you will lose more than hours in deleting the logs.

In such cases don’t delete logs from setup, use the powerful toll Developer Console 😀 .

HOW???

Follow below steps:

  1. Open Developer Console.
  2. Use keyboard and click CTRL+SHIFT+O -> This will open ‘Open Resource’ window.
  3. In the search box, search for ApexLog.obj object
  4. Select Id field and Click on Query
  5. This will generate the query
  6. Or ignore Step 2 to Step 5 and simply write down the query ‘SELECT Id FROM ApexLog’ in the ‘Query Editor’.
  7. Check the check box ‘Use Tooling API’ and click on ‘Execute’
  8. Now select the rows (CTRL+A) from ‘Query Results’ and click Delete Row.
  9. Leave the window, as this will take some time to delete the logs. You can click on Refresh Grid to see if all gets deleted.
  10. Please note this will only delete the rows you have selected. So even if you need you select the remaining rows again and again, still this is the fastest way to delete the logs.

Wait! If you want to delete debug logs in lightning speed then Visit this Post

Happy Learning 😊