34

I am trying to update the debug log trace flag for my user but getting the following error

Having an active trace flag triggers debug logging. You have 259 MB of the maximum 250 MB of debug logs. Before you can edit trace flags, delete some debug logs.

I have removed all existing debug logs but it is still throwing the error.

63

I have faced this issue, which I fixed it by deleting all debugs logs from developer console.

  1. In dev console, Select tab "Query Editor" at the bottom of the console
  2. Select check box "Use Tooling API"
  3. Use this query:

    SELECT Id FROM ApexLog
    
  4. Delete all rows (Use shift key to select all rows)

https://help.salesforce.com/articleView?id=000194045&type=1

Once all rows are deleted you will be able to save new debug logs.

  • The moment I click on delete the whole system hangs. Is there is any solution to this. We have around 2000 apex logs rows in org – Monalisa Das Mar 14 at 14:56
  • @MonalisaDas do in cunks by having a limit `SELECT Id FROM ApexLog LIMIT 200' and then delete – Pranay Jaiswal Mar 14 at 14:57
  • This worked for me. However...having to do it this way makes me cringe. This functionality should have been built into the Debug -> Clear menu. I know Salesforce is moving to VS Code and scratch orgs but I still use dev console for running test suites, so it sucks to have logs "fill up" like that. – Ixalmida May 2 at 16:05
  • 1
    +1 nice!!...... – salesforce-sas Aug 5 at 16:31
9

The short term solution is to keep playing whack-a-mole~ApexLog as Pranay has suggested.

Longer term, the problem comes back to the Summer'18 update Store Larger Debug Logs with Changed Log Limits:

We increased the size limit for debug logs from 2 MB per log to 5 MB. You can store up to 250 MB of debug logs at a time. System logs are now deleted automatically after 24 hours instead of after seven days. Monitoring logs are still saved for seven days.

This is also compounded with the Winter '18 update Retain More Debug Logs for Longer:

We changed the way that we delete old debug logs. We now retain debug logs for 7 days. You can generate a total of 250 MB of debug logs in a 15-minute window. When your org is upgraded to Winter ’18, all logs that are at least 7 days old are deleted. This change applies to both Lightning Experience and Salesforce Classic.

Previously, you could generate up to 50 MB of debug logs. We kept them indefinitely, deleting the oldest log each time that you exceeded the limit. We removed the 50 MB limit and changed to a 7-day storage limit.

A couple of releases ago you had Apex logs up to 2 MB in size with a total limit of 50 MB that would automatically drop the older logs.

Currently (Winter '18) you have logs up to 5 MB in size with a total limit of 250 MB that can stay around for up to 7 days before being automatically purged. As many are finding, in a busy org it is easy to hit that 250 MB limit in a much shorter time period than 7 days.

I've created the idea Allow TraceFlags to indicate that Debug logs can be deleted automatically. The idea is to give the developer/admin control how how long they need the corresponding logs to stay around for. With a TTL (Time to Live) setting on each generated log they could be cleared out automatically while still giving the flexibility to capture a few large short term logs or smaller logs with a longer life span.

Nathan Totten is the current PM for this area an is aware of the issues it is causing - https://twitter.com/ntotten/status/1007432141725224960


Note, I've copied this answer out of a duplicate question to here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.