When running Anonymous apex, Seeing the error "This org has reached its daily usage limit of apex log headers"
Understanding DebuggingHeader in Salesforce API Call
When you invoke Apex through API calls, Salesforce offers a debugging facility that provides detailed insight into code execution. This is enabled via the DebuggingHeader element in your API request.
Using the categories
and level
fields within DebuggingHeader
, you can control the granularity of debug logs you receive.
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.
Common Issue: Daily Debug Log Header Limit
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.
How to Fix or Prevent This Issue
Here are some best practices to avoid exhausting the log header quota:
-
Minimize Anonymous Apex Executions
Consolidate your logic to reduce repeated test runs and executions. -
Remove Unnecessary DebuggingHeaders
Review all API integrations (e.g., Mulesoft, Postman scripts, etc.) and ensureDebuggingHeader
is included only when truly needed.A common mistake is having connectors (like MuleSoft) default to always sending debug headers, rapidly consuming the quota unintentionally.
Thanks for reading! Hope this was helpful.
Cheers!
Comments
Post a Comment