cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@s-und-n.de>
Subject RE: cvs commit: xml-cocoon2/src/java/org/apache/cocoon/environment AbstractEnvironment.java
Date Thu, 16 Jan 2003 16:16:30 GMT

Vadim Gritsenko wrote:

> >  -            getLogger().debug("redirect: entering session mode");
> >  +            if (getLogger().isDebugEnabled()) {
> >  +                getLogger().debug("redirect: entering session mode");
> >  +            }
> >
> 
> Hi Carsten,
> 
> I think you overdoing this a bit: if(){debug()} here is twice less 
> efficient as single debug() call, because debug()'s argument is the 
> constant from the class' constants pool, not a dynamic string.

I don't want to discuss if isDebugEnabled() is not as efficient as
debug() - but I really guess it is.
The reason for the change above is simple, it's a) consistent and
b) if you change the log message and add some dynamic information the
extra check is there and cannot be forgotten.

This is really a problem, because we agreed a long time ago do to the
extra checks. Take a look at the code, there are still places where
the extra checks are not done as not all of us really care about this.

> 
> IIRC, we already agreed some time ago that simple debug output should 
> not be wrapped into if().
> 
Hmm, I cannot remember anything like this, sorry. (weak mind perhaps?)

Carsten

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message