tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From luca passani <pass...@eunet.no>
Subject Re: question about integration with log4j
Date Tue, 01 Feb 2005 15:01:03 GMT

Do you use some tricks to make the compiler remove the debugging info completelly at build
time?
for ex, making isBebug() return a constant false value? 

Luca

David McReynolds wrote:
> 
> On the last two struts projects we have adopted the policy of wrapping
> our log4j info and debug statements in an if clause.
> 
> if(logger.isBebug()) {
>   logger.debug("i am here");
> }
> 
> 1. method call overhead is kept to a minimum.
> 2. You can use the body to conditionally build a complex logging statement.
> 
> if(logger.isBebug()) {
>   StringBuffer s = new StringBuffer();
>   s.append("i am here now with x = ").append(this.x).append(" and y =
> ").append(this.y);
>   logger.debug(s.toString());
> }
> 
> Heck, since its a debug statement you might even allow the use of the
> string concatenation operator (+) even though it is orders of
> magnitude more costly in time and memory.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message