Howdy,
This is off-topic now, but the short answer is no. The longer answer is
that java doesn't have such constructs at runtime, and we are talking
about runtime not recompiling the code. The even longer answer has to
do with log4j architecture and Logger#debug being a potentially very
expensive call depending on its parameters and configured appenders,
whereas isDebugEnabled is an optimize hash lookup.
Yoav Shapira
Millennium ChemInformatics
>-----Original Message-----
>From: Graham Reeds [mailto:grahamtomcat@(protected)]
>Sent: Thursday, December 04, 2003 9:05 AM
>To: Tomcat Users List
>Subject: Re: How to measue performance? Log4j on/off.
>
>>>>>
>As an aside, make sure you have all log4j Logger#debug statements
>enclosed in if(logger.isDebugEnabled()) { ... } clauses -- that's an
>order of magnitude or so runtime performance improvement.
>>>>>
>
>Showing my C heritage here, but can't you do something like
>
>Log("an error has occurred");
>
>And in Log have a directive like
>
>class Logger()
>{
> void Log(string msg)
> {
>#ifdef DEBUG
> ... log message ..
>#endif
>};
>
>And so you can compile a version with debug or no debug. Those if()
>statements are still going to take time to process, even if there is no
>logging going on.
>
>G.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
>For additional commands, e-mail: tomcat-user-help@(protected)
This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)