Skip to main content

When running Anonymous apex, Seeing the error "This org has reached its daily usage limit of apex log headers"

All API calls that invoke Apex,  support a debug facility that allows access to detailed information about the execution of the code. We use the Categories and Level fields of DebuggingHeader of the request to see the logging granularities.


Sample DebuggingHeader  

<urn:DebuggingHeader>

<!--Zero or more repetitions:-->

<urn:categories>

<urn:category>Apex_code</urn:category>

<urn:level>FINEST</urn:level>

 </urn:categories>

<urn:categories>

<urn:category>Apex_profiling</urn:category>

<urn:level>FINER</urn:level>

</urn:categories>

</urn:DebuggingHeader>


The debugLog field of DebuggingInfo response header contains the debug logs based on the log level set in the request.

The error "This org has reached its daily usage limit of apex log headers" occurs when you run too many API calls that request the Debugging information for the execution of code. 

Salesforce limits the number of log headers that can be generated in a single day for each org. Once you reach the limit, you won't be able to execute any more API calls which request the Debugging information until the next day.

The default limit is 1000 per 24hr period. Unlike other limits, This is not something we can increase with Salesforce support.

To resolve this issue, you can try the following:

  • Reduce the number of times you execute Anonymous Apex code. Instead, try to consolidate your code into fewer executions.
  • Try checking all the API calls' request to your Salesforce org, Remove DebuggingHeader from the request if the logs are not necessary. For example. Incorrect configuration in Mulesoft Connector can cause the DebuggingHeaders to be included always in the API requests which can consume this limit quickly.


I hope this helps!  Thank you for reading this article. Cheers:)

Comments