cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: [RT] Logging in 2.2
Date Wed, 05 Jan 2005 21:52:58 GMT
Nicola Ken Barozzi wrote:

> I saw that too, but UGLI should not need that extra isLogEnabled stuff 
> in any case.
>
> BTW, I love the way this makes one write log messages, it's what we 
> have in POI, and is very convenient.
>
> Ceki wrote:
> "
> As noted in my previous message, UGLI also supports parameterized log
> messages obliterating the need to surround log messages with
> logger.isXXXEnabled checks.
>
> Instead of writing:
>
>    if(logger.isDebugEnabled()) {
>      logger.debug("User with "+id+" entered wrong query string 
> ["+query"]." );
>    }
>
> you can just write:
>
>    logger.debug("User with {} entered wrong query string [{}].", id, 
> query);


IMO, this is bad syntactic sugar, as it may lead people to forget that 
parameters have to be evaluated too. Consider this:

    Source src = resolver.resolveURI("http://slow.server.com/");
    logger.debug("Length is {} bytes", src.getLength());

An http request on each run, even if debug is disabled!

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Mime
View raw message