You need to sign in to do that
Don't have an account?

Is there a way to Debug Print the Number of SOQL Queries During Runtime?
I am troubleshooting System.LimitException: Too many SOQL queries: 101 errors in test classes. Is there a way that I can place i.e. system.debug('<current # on SOQL queries>'); to see where in my code that the SOQL queries jump in debug logs? Is there such a way to reference this global SOQL query count in my apex code?
Thank you.
Try this:
System.debug('Total Number of SOQL Queries allowed in this apex code context: ' + Limits.getLimitQueries());
from this blog post:
http://mail.database.com/page/Best_Practice:_Use_of_the_Limits_Apex_Methods_to_avoid_Hitting_Governor_Limits
All Answers
Try this:
System.debug('Total Number of SOQL Queries allowed in this apex code context: ' + Limits.getLimitQueries());
from this blog post:
http://mail.database.com/page/Best_Practice:_Use_of_the_Limits_Apex_Methods_to_avoid_Hitting_Governor_Limits