Monday 15 June 2015

Filtered (not printed-out) logging and performance in Java -


I know that logging may degrade the application's performance. I am thinking that logging effect on the execution of the app It will be worth noting if all logging will be filtered using a suitable logging filter.

I am thinking about this because I am considering implementing my login application because it can be very useful, but (possibly) not at the cost of making it slow.

AAAIX, logging is usually (that is, from your normal implementation) done in a separate thread, So it does not really affect your performance.

When adding logging, I have learned to avoid the performance hit: To check whether the proper logging level is enabled before combining any string to create a log message, always check it:

  if (log.isInfoEnabled ()) {log.info ("this log message has some string containment" + log in value); }   

In this way, if the logging level is set to slightly more than the threshold INFO, then you will not run the string combination.

No comments:

Post a Comment