It's recommended practice whether there are ten gazillion statements or not!
However, I agree that it's frustrating to see methods bloated because of
Log4J calls. I put in an Eclipse feature request for code filtering on the
Java editor that could be used for operations such as hiding all Log4J code.

-----Original Message-----
From: STONE,ROBERT (HP-SanDiego,ex1) [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 23, 2003 12:09 AM
To: '[EMAIL PROTECTED]'
Subject: RE: Logging format


I guess, if you have 10 gazillions of these statements in your code... The
very first line inside the method is isDebugEnabled() however the price paid
is creation of the String parameter. Makes sense now, thanks

Bob S.

-----Original Message-----
From: Marcin Maciukiewicz [mailto:[EMAIL PROTECTED]
Sent: Friday, August 22, 2003 2:50 PM
To: STONE,ROBERT (HP-SanDiego,ex1)
Subject: Re: Logging format


Witaj ex1),

W Twoim liście datowanym 22 sierpnia 2003 (19:03:18) można przeczytać:


SRHSe> Hi guys,

SRHSe> Just curious why you're using in your code constructs like

SRHSe> if ( log.debuggingIsEnabled() ) {
SRHSe>         log.debug( "foo" );
SRHSe> }

SRHSe> Isn't this redundant? After all log.debug() will only output
SRHSe> messages when debugging level is set to DEBUG. Why not just use
SRHSe> log.debug( "foo" )? Saves you two lines...

JVM ommit those lines when
log.isDebugEnabled==false without carrying about log.debug(...). If U have
many log.debug calls it gives your code little speed-up.

Check http://jakarta.apache.org/log4j/docs/manual.html
"Performance" chapter


--
Greetz ciukes



Reply via email to