geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Blewitt <Alex.Blew...@ioshq.com>
Subject Re: Logging code and Garbage Collection
Date Wed, 13 Aug 2003 16:46:17 GMT
On Wednesday, Aug 13, 2003, at 17:33 Europe/London, Gareth Bryan wrote:

> I think runtime swapping of log levels is a very powerful feature: we
> should have this feature if it is at all feasible.
>
> Also:
>
> I have written loggers in the past which fail **very** quickly if a
> particular level is not enabled.  The logger implementation uses a
> delegate mechanism whereby when setLogLevel() is called (ie during 
> init),
> any log levels which are not operational have their request mapped
> through to a NullLogger.  Thus the only overhead of calling a log 
> method
> for a level which is not enabled is the method location + stack 
> overhead.

Don't forget that any argument will still be evaluated prior to that 
logging call. That's why some of the earliest oggers used methods that 
took an array of Object expressions, and then only ran the string 
contat stuff if the logging was enabled.

A NullLogger would work very quickly, but you'd still need to catch out 
for all those expression evaluations prior to the log message being 
ignored.

Alex


Mime
View raw message