Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[riena-dev] Cache for LOGGER.isLoggable

Hi riena-dev,

 

When we use Log4r.getLogger() to get a logger, there is a method isLoggable(int level). Using debugger to track turns out that it looks like every time this method is called, it consults every registered log listener to ask if this log level is loggable, which looks like is resource consuming if there are many service enquiring if the log level is available.

 

The isLoggable method should be a quick one that pre-checks if the log level applies to current environment, as sometimes dumping log data is quite resource consuming and not needed in production mode.

 

Maybe it is good to introduce some cache for the isLoggable method as there are just a few log levels and the result is not likely to change in application execution time.

 

Thanks for any thoughts.

 

Regards,

 

Patrick He

 


Back to the top