cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Ken Barozzi <>
Subject Re: [RT] Logging in 2.2
Date Wed, 05 Jan 2005 16:09:10 GMT
Bernard D'Have wrote:
> Hi,
> Just a pointer to a thread aout UGLI in Jakarta HttpClient:

Since the URL of this archive may break in the infra reorg that is 
happening, here is IMHO the point:

Since the org.apache.log4j.Logger class is a direct implementation of
org.apache.ugli.ULogger interface, there is no need to wrap a log4j
Logger to conform to the UGLI interface. Log4j Loggers are already
ULoggers. It follows that the objects returned by
o.a.ugli.LoggerFactory.getLogger("x") are identical to those returned
by o.a.log4j.Logger.getLogger("x").

Thus, using UGLI in conjunction with log4j will not carry any overhead

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, 

Give or take a nano-second, when the log statement is disabled, both
forms perform equally well but the second form is easier to read and
to write.

Nicola Ken Barozzi         
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)

View raw message