avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylvain.wal...@anyware-tech.com>
Subject Re: [LogKit][PATCH] 'method' field for PatternFormatter
Date Wed, 25 Jul 2001 14:43:03 GMT


Stuart Roebuck a écrit :
> 
> Apologies,
> 
> My last patch is based on a misinterpretation of the original code.  This
> doesn't give the method from which the LogEvent was called: only the Class.
>    It's still useful, but the names of my methods and the field are
> inappropriate.
> 
> Stuart.
> 
Ok, as the original author, let me explain what I've done with the new
log formatter in Cocoon.

First of all, I didn't submitted it as a patch to LogKit because it was
at first a Cocoon-specific extension (logging request information) in
which I added some stuff from an old in-house logging component.

In order to be able to extend PatternFormatter with new pattern strings,
I had first to refactor it a little bit. This is the
ExtensiblePatternFormatter which is functionally identical to the
original PatternFormatter (no more, no less features) but provides more
protected methods for subclass implementation.

Then comes the CocoonLogFormatter which introduces 3 new patterns :
- "uri" : the servlet request URI, which is totally cocoon-specific
- "thread" : prints the thread name. This is also cocoon specific since
it relies on the ContextStack set by the Cocoon servlet.
- "class" : prints the name of the class that called Logger.

This last pattern isn't Cocoon-specific and was designed to be as
CPU-cost-aware as possible : the caller class is computed only if
"%{class}" is present in the pattern. I explained the inner details to
Stuart which was asking about performance :
http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=99597653529789&w=2

The only drawback (see javadoc) is that it doesn't work with
AsyncLogTarget. Computing the caller class in LogEvent as proposed by
Stuart would circumvent this limitation, but require computation for
each event logged, even if not used later, which IMO is too costly.

Since there seems to be interest for it, the files are attached and I'd
be happy to see the non-Cocoon specific part of them included in a
future LogKit release.
-- 
Sylvain Wallez
Anyware Technologies - http://www.anyware-tech.com
Mime
View raw message