commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: [logging] bytecode engineering (was: Re: Commons Configuration - Digester Logging turned off)
Date Tue, 26 Oct 2004 22:35:35 GMT
On 26 Oct 2004, at 22:40, Simon Kitching wrote:

> On Tue, 2004-10-26 at 10:47, robert burrell donkin wrote:
>> this might be a bit left field but i've been turning over the idea for
>> some time of using byte code engineering to wire up logging. one of 
>> the
>> problems with commons-logging is that it's nearly impossible to be all
>> thing to all people. the idea of running an enhancer at at a jar to
>> turn off logging (complete), switch to micro-thin logger or a non-j2ee
>> one appeals to me.
>
> It does seem tempting from a performance point of view. I've always
> thought it a bit odd that log4j goes to great lengths to optimise
> performance, then commons-logging adds a layer of indirection on top
> which is executed for every log statement (including those which are
> filtered out). Modifying the bytecode to make direct calls to the
> selected logging library seems nicer.

from a performance perspective, i'm not convinced that the extra call 
layer should make much difference in practice. (highly optimized loops 
should not contain any logging statements.) i strongly suspect that the 
principle cost in commons-logging is the cost of getting a log from the 
factory.

i'd say that just hard wiring a Log implementation for each 
LogFactory.getLog() would be good enough for a proof-of-principle.

> However I'm not sure how this can be done in practice. This means
> ensuring every class that can potentially use logging must be loaded 
> via
> a custom classloader so that the bytecode can be modified as the .class
> file is read from disk, right?

i'd go for static modification: run an enhancer ant task at a 
commons-digester.jar
and create a commons-digester-no-logging.jar with logging turned off. 
custom classloaders seem like a whole lot of no fun...

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message