|
Class StandardQueryCache has code that detects the status of LOG.isTraceEnabled() and LOG.isDebugEnabled only once during the startup of the library:
private static final boolean DEBUGGING = LOG.isDebugEnabled(); private static final boolean TRACING = LOG.isTraceEnabled();
Way this may seem as a smart way to optimize some CPU cycles, this is bad. It kills the feature of dynamic re-configuration of the underlying logging feature. You can't enable TRACE level on org.hibernate.cache anymore during runtime. Secondly, this is an anti-pattern. I think it is better to rely on the logging framework to be smart enough to optimize the call to isTraceEnabled(), instead of doing it yourself.
Thanks, Yoni
|