shreyas-girjapure / apex-logging

Reusable and Minimal Logging Framework Using Platform Events.
1 stars 2 forks source link

Comparison of logging level debug and logging level Error #9

Closed shreyas-girjapure closed 2 years ago

shreyas-girjapure commented 2 years ago

Screenshots and sample codes are expected at the end of result

Mehul-Suryavanshi commented 2 years ago

Actions Performed - Ran a script which logged msg using 1. system.debug('Hello'); and 2. system.debug(logginglevel.ERROR,'Hello'); over an iteration of 10000.

Observations - In first scenario, i.e. for logging level DEBUG, system took 1.273 secs to process the entire operation, but for second scenario, i.e. for logging level ERROR, system took almost half the time than previous operation, which was about 0.669 secs.

Conclusion - The use of logging level DEBUG must be avoided on production package. And in case we intend to use debug statements, then we must keep logging level as ERROR so as to reduce CPU time.

PFA Logs for both Scenarios LoggingLevel_ERROR.log LoggingLevel_DEBUG.log