It avoids the creation of the debug string, over time this can get costly. We had a huge problem with this at my last job and we improved performance quite a bit by simply wrapping our debug logs in an if statement. the JIT pretty much compiles out the block at runtime.
We are NOT that good at remember to do the wrapping, as there are a ton of other places. With info, we usually want that to happen so the extra if check is a waste, and with warn we definitely want those but they are usually edge cases during an exception or something like that. Debugs are much more prevalent and we want to avoid having to deal with all the string creation they cause. jesus On Tue, Mar 17, 2009 at 11:40 PM, Justin Sherrill <[email protected]> wrote: > jmrodri wrote: >> Please wrap the log.debug() with if (log.isDebugEnabled()) {... >> log.debug(); } >> >> jesus > > Out of curiosity what is the benefit of this ? Speedier execution ? > > -Justin > > >> >> >> >> >> >> Sent to you by jmrodri via Google Reader: >> >> >> >> >> >> making log statment debug as it was intended to be >> >> <http://git.fedoraproject.org/git/?p=spacewalk.git;a=commitdiff;h=77f50aaa8774e1b1812a73308b2c55eacd717454> >> >> via Fedora Hosted Git Repositories - spacewalk.git/rss log >> <http://git.fedoraproject.org/git/?p=spacewalk.git;a=summary> by Justin >> Sherrill <[email protected]> on 3/16/09 >> >> making log statment debug as it was intended to be >> >> * [D >> >> <http://git.fedoraproject.org/git/?p=spacewalk.git;a=blobdiff;f=java/code/src/com/redhat/rhn/manager/errata/cache/ErrataCacheManager.java;fp=java/code/src/com/redhat/rhn/manager/errata/cache/ErrataCacheManager.java;h=78789cb848824105b4095382388f82a4acae374e;hp=c69e99d855f0337adfb723303ef471522b62ea1f;hb=77f50aaa8774e1b1812a73308b2c55eacd717454;hpb=822ad7202b85a42f2923e19de9d615bad62dac72>H >> >> <http://git.fedoraproject.org/git/?p=spacewalk.git;a=history;f=java/code/src/com/redhat/rhn/manager/errata/cache/ErrataCacheManager.java;h=77f50aaa8774e1b1812a73308b2c55eacd717454>] >> >> java/code/src/com/redhat/rhn/manager/errata/cache/ErrataCacheManager.java >> >> >> >> >> >> >> Things you can do from here: >> >> * Subscribe to Fedora Hosted Git Repositories - spacewalk.git/rss >> log >> >> <http://www.google.com/reader/view/feed%2Fhttp%3A%2F%2Fgit.fedoraproject.org%2Fgit%2F%3Fp%3Dspacewalk.git%3Ba%3Drss?source=email> >> using *Google Reader* >> * Get started using Google Reader >> <http://www.google.com/reader/?source=email> to easily keep up >> with *all your favorite sites* >> >> >> >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Spacewalk-devel mailing list >> [email protected] >> https://www.redhat.com/mailman/listinfo/spacewalk-devel > > > -- > Justin Sherrill, RHCA 1801 Varisty Drive. > Software Engineer Raleigh, NC 27603 > Red Hat, Inc. > > _______________________________________________ > Spacewalk-devel mailing list > [email protected] > https://www.redhat.com/mailman/listinfo/spacewalk-devel > _______________________________________________ Spacewalk-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/spacewalk-devel
