cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tagunov Anthony" <atagu...@nnt.ru>
Subject Re: log performance penalties
Date Sun, 18 Feb 2001 18:38:58 GMT
Hello, Cocooners!

On Sun, 18 Feb 2001 16:33:31 +0100, Stefano Mazzocchi wrote:

>Tagunov Anthony wrote:
>> 
>> Hello, evrybody!
>> 
>> On Thu, 15 Feb 2001 15:49:24 +0100, Stefano Mazzocchi wrote:
>> 
>> >I'm looking at the changes made to Cocoon while I was away:
>> >
>> >are you guys aware of the fact that something like
>> >
>> >  getLogger().debug("Making URL from " + location);
>> 
>> Maybe doing something like getLogger().debug("Making URL from",location)
>> would make things easier?
>
>Hmmm, what if you want to log something like
>
> "this " + code + " has been " + action + " at time " + time
>
>???

Sure, this approach is not universal.. 

1)
As for number of parameters:
i personally see no trouble in
having 9 .log methods with number of parameters from 1 to 9 respecitvely, if
it saves performance! And I beleive there's a sane limit that a regular
log request does not come over..

2)
parameter types, yes, this is the real trouble
there's one more trick from my practice that i can propose:
to log "this " + code + " has been " + action + " at time " + time one
could 

getLogger().debug("this"); getLogger().debug(code); getLogger().debug("has been")...  getLogger().debugNewLine();

and the logger would have
debug(int), debug(String), debug(Time) methods and would sum up them in it's internal
(kept per-thread) StringBuffer (so there's either a logger instance per thread, or
each logger keeps per-thread information). The call degubNewLine() would actuall
take the whole accumulated buffer and put it to the log.

I used this approach in .cpp programs to avoid hussle with putting
"this"+code+"has been" before doing a log() call. In C this resulted in even
shorter and more understandable code. In Java it won't, but if it save 
performance..


>> I'm speaking about implementing things like debub(String), debug(String,String),
debug(String,String,String)?
>> That's what i do for my applications (non-cocoon)
>
>It's in these situations I wished java was aspect oriented :(
>
>-- 
>Stefano Mazzocchi      One must still have chaos in oneself to be
>                          able to give birth to a dancing star.
><stefano@apache.org>                             Friedrich Nietzsche
>--------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
>For additional commands, email: cocoon-dev-help@xml.apache.org
>
>




Mime
View raw message