cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giacomo Pati <>
Subject Re: log performance penalties
Date Thu, 15 Feb 2001 21:08:14 GMT
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);
> is translated by java compilers into
>   StringBuffer sb = new StringBuffer("Making URL from ");
>   sb.append(location);
>   getLogger().debug(sb.toString());
> which generates
>  1) a new stringbuffer object
>  2) a new String
> even if debug log channel is disabled?
> Probably so, but just to make sure.

I'm fully aware of that but it has helped alot finding bugs because C2 is a 
very distributed exeption throwing and eating beast :). Most of the logging 
stuff come from Berin and I've found that it was easy to debug now.

> The only way to do it well is by wrapping the whole call around a log
> channel test such as
>  if (getLogger().debugIsActive()) getLogger().debug("Making URL from " +
> location);

I've thought of how to weaken that and your idea seems to be one solution. 
The radical solution I had was to pipe the code through a filter that 
eliminates all the debug loggin stuff (but in fact this would be a loss)

> FYI, doing this in JServ 1.0 resulted in a 20% performance improvement.
> I understand that performance fine tuning is very low priority right now
> (and rightly so!) but please, keep this in mind from start or profiling
> will be a major pain in the ass later on.

View raw message