geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Strachan <>
Subject Re: [Logs] Re: Logging code and Garbage Collection
Date Thu, 14 Aug 2003 22:34:40 GMT
Just to be clear - if I understand Dain's patch correctly - it 
optimises isXEnabled() calls by caching the value in an instance 
variable inside the Log proxy so the JVM can inline it - rather than 
the slightly expensive internal call to a singleton which uses 
synchronization in log4j..

It comes from the discussions of isXEnabled() methods being slow in 
Axis etc.

On Thursday, August 14, 2003, at 11:26  pm, Dain Sundstrom wrote:

> On Thursday, August 14, 2003, at 05:08 PM, Alex Blewitt wrote:
>> I fear that this is a tad pointless; the logs in Log4J are going to 
>> do this anyway, and not cache the log values.
> I disagree that this is pointless.  We need something for today (it 
> took about a half hour), and when they get their stuff working, we 
> remove my code.
>> The big problem was that when doing log("String" + value + "message") 
>> is that the string concatenation is always done, regardless of 
>> whether the log level was enabled or not. That is why it was 
>> desirable to surround with the if() statements in the first place ...
> Duh.  We all agree on that.  But when you have debug("my single string 
> message") there is not need to wrap, and when you do need the 
> isDebugEnabled() call, it will be very fast.
>> So the problem is still going to exist, albeit a factor slower since 
>> it's going through this caching log :-/
> Agree, that is what caching is all about.
> -dain


View raw message