function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Wayne Cordrey 29Wayne Cordrey 29 

Apex Limit class- can we report on limits?

I would like to be notified when we hit certain level on limits-  well before hitting actual salesforce limits.  So for SOQL queries, I'd like to know when we hit 25% of limit.  Ideally, I'd like a log file with a log line showing when SOQL limits hit 25%, APEX Heap limit at 25%, APEX CPU at 50%, etc.   

Is this possible using the Limits class?  Is there an example of this?  

THanks

AbhinavAbhinav (Salesforce Developers) 
Check this:

https://salesforce.stackexchange.com/questions/140348/avoid-hitting-soql-limits-but-know-that-i-was-about-to-hit-them

https://wedgecommerce.com/prevent-hitting-soql-query-limit-apex/

Thanks!