You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Bob Herrmann <bo...@jadn.com> on 2002/07/23 21:03:02 UTC
[PATCH] Re: JDK 1.4 Logging
On Mon, 2002-07-22 at 14:18, costinm@covalent.net wrote:
>
> I think there is a simpler solution for this class of problems, and
> that would also work with log4j and doesn't require _any_ API change.
> ( only changes to the adapter implementations )
>
> Any 'wrapper' will use:
> factory=LogFactory.getFactory();
>
> factory.setAttribute( "commons-logging.wrapperClass",
> "[CLASSNAME-OF-WRAPPER]");
> factory.getLog(), etc.
Ok, I experimented some with this. I found that the "wrapperMethod"
(namely looking for method names "log()" and "internalLog()") are more
effective than a classname for identifying "uninteresting" stack frames.
Seems Tomcat has 71 classes with a method named "log()" and often
logs messages from within the class itself.
The attached "patch.txt is the Change to commons.
The CommonsLogger.java is a new tomcat logger that sends output
to the commons-logger.
Does this look good?
Cheers,
-bob
>
> The classname of wrapper will be passed to the impl..
>
> - for log4j - this just gets passed further, since log4j already supports
> this feature.
> - for jdk1.4 or other loggers who don't support wrapping - there is
> already code in Jdk14Logger that walks the stack trace. Curently it
> uses a hard-coded '2 levels up', but it can use the wrapperClass
> and walk up to find it.
>
>
> Costin
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
[logging] [PATCH] JDK 1.4 Logging
Posted by Bob Herrmann <bo...@jadn.com>.
On Tue, 2002-07-23 at 15:03, Bob Herrmann wrote:
> On Mon, 2002-07-22 at 14:18, costinm@covalent.net wrote:
> >
> > I think there is a simpler solution for this class of problems, and
> > that would also work with log4j and doesn't require _any_ API change.
> > ( only changes to the adapter implementations )
> >
> > Any 'wrapper' will use:
> > factory=LogFactory.getFactory();
> >
> > factory.setAttribute( "commons-logging.wrapperClass",
> > "[CLASSNAME-OF-WRAPPER]");
> > factory.getLog(), etc.
>
Hi. This patch to commons logging allow you to specify which methods
in the call stack are uninteresting when using the JDK1.4 Logger. In
Tomcat this seems to be all methods named "log" and "internalLog." This
is based on Costin's idea of uninteresting classes, but seems to work
better for method names (in Tomcat anyway.)
It is something of a back door. It is primarily for projects that
are in the process of converting to using commons-logging.
Is this an acceptable change to commons-logging ?
Cheers,
-bob
P.S. this patch is updated from the one posted to tomcat-dev