Loading

Best practices for using debug logs with trace flags in Production

Publiceringsdatum: Jun 16, 2026
Beskrivning

When setting up debug logs in a Salesforce Production org using trace flags, be aware of platform limits. The default debug log storage limit is 1,000 MB, and trace flags expire after 15 minutes. For instructions on how to set up debug logs on an Apex class or user, follow the standard Salesforce Help steps for enabling trace flags.


If the Apex class or user being traced generates many small debug logs per minute, and if this approaches the 15-minute expiry or 1,000 MB storage threshold, the likelihood of request failure in your org increases significantly.

Lösning

Best Practice: Avoid Trace Flags on High-Volume Code Paths

Do not enable trace flags on API users or Apex classes that are on a critical Apex code path with high execution frequency during peak business hours. Enabling debug logging on these high-traffic paths can cause performance degradation and increase the risk of request failures.

 

Additional Considerations

  • Enable trace flags during off-peak hours or on dedicated test users to minimize impact.
  • Be aware that trace flags have a maximum duration of 15 minutes per flag.
  • The total debug log storage per org is 1,000 MB. Logs generated beyond this limit are not retained.
  • If you need persistent logging, consider using Platform Event-based logging or custom logging frameworks.
Knowledge-artikelnummer

000395769

 
Laddar
Salesforce Help | Article