tag:blogger.com,1999:blog-8342347821869463061.post2260638304822838962..comments2023-11-02T17:30:26.989+05:30Comments on My Technical Scratch Pad.: web application logging dilemmahimanshuhttp://www.blogger.com/profile/02909790425038294533noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-8342347821869463061.post-24027355423593086022010-10-31T22:58:57.836+05:302010-10-31T22:58:57.836+05:30No, because in our case(and usually) log is not an...No, because in our case(and usually) log is not an instance of any custom written class. It is an instance of log4j framework class org.apache.log4j.Logger.<br /><br />And, even if we create a custom class to handle the check inside it.. that will defeat the purpose of check as it is mainly put to save unnecessary evaluation(when you're not printing debug logs) of expression passed as argument to the debug method(in this case one string concatenation). It can be saved without the check in a language that supports "lazy evaluation" of method arguments.himanshuhttps://www.blogger.com/profile/02909790425038294533noreply@blogger.comtag:blogger.com,1999:blog-8342347821869463061.post-81927482283075097132010-10-31T17:00:56.909+05:302010-10-31T17:00:56.909+05:30Probably silly, but did you consider moving the de...Probably silly, but did you consider moving the decision to check `log.isDebugEnabled()` to *inside* the `log` class? <br /><br />Then you could merely write: `log.debug("your error message" + usually_a_concatenation)` everywhere.Manoj Govindanhttps://www.blogger.com/profile/12734036974316245850noreply@blogger.com