cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: [RT] Logging in 2.2
Date Thu, 06 Jan 2005 22:26:39 GMT
Gianugo Rabellino wrote:
> On Wed, 05 Jan 2005 15:42:08 -0500, Stefano Mazzocchi
> <stefano@apache.org> wrote:
> 
>>Nicola Ken Barozzi wrote:
>>
>>>Antonio Gallardo wrote:
> 
> 
>>>I saw that too, but UGLI should not need that extra isLogEnabled stuff
>>>in any case.
> 
> 
> How so? What am I missing?
> 
> 
>>>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);
>>>"
>>
>>very pythonish. I like it :-)
>>
>>-1 on just4log then.
> 
> 
> I'm probably not getting the point. This solves the string
> concatenation issue (which, besides and AFAIU, today is quite a bit
> faster than it used to be in older JVMs), but isn't necessarily, and
> per se, a permanent solution.  Since this is an interface (and quite
> an ugly one given the two parameter limitation... what's wrong with a
> logger.xxx(String message, String[] params) as an alternative?), you
> don't know if the current implementation just tokenizes the message
> and performs concatenation anyway. Moreover, this is no solution to
> logger.debug("my {} message", runMeAndIllKillYourMachine()) which
> still would need to be wrapped...

right, forget what I said.

-- 
Stefano.


Mime
View raw message