While with my mind on some unrelated performance issues in a project I scanned through some tips in http://www.javaperformancetuning.com
The ones in http://www.javaperformancetuning.com/tips/final.shtml made me think that maybe the best logger definition whould be - private static final LOG = Logger.getLogger(MyClass.class); I quote - "Generally, I wouldn't go out of my way to declare a method or class final purely for performance reasons. Only after you've definitely identified a performance problem is this even worth considering. On the other hand, final variables, especially static final variables, are well worth using as standard." A tip further down for another logging system would suggest that for log4j even better performance could be gained by using both - private static final LOG = Logger.getLogger(MyClass.class); private static final DEBUG_ENABLED = LOG.isDebugEnabled(); Then in code it would be if (DEBUG_ENABLED) LOG.debug("Hello Logging World"); Is there any reason why this is not already suggested on the log4j website. Is there any circumstance for which it wouldn't be recommended? Bob. ----------------------------------------- Email provided by http://www.ntlhome.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
