commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Herrmann <...@jadn.com>
Subject Re: [Logging] more issues with stack reading
Date Fri, 26 Jul 2002 19:12:44 GMT
On Thu, 2002-07-25 at 14:44, Bob Herrmann wrote:
> On Thu, 2002-07-25 at 14:16, Patrick Luby wrote:
> > Costin and Bob,
> > 
> > costinm@covalent.net wrote:
> > > 
> > > The problem we're having is support for the old wrappers in
> > > tomcat, as we need to filter them out too. We're trying to 
> > > get commons-logging used everywhere, but keep backward 
> > > compatibility since the Logger/Log interface is part of the 
> > > tomcat APIs. 
> > > 
> > 
> > I may be missing something, but would a possible approach be to change 
> > all of the Logger/Log interface calls to commons-logging in the new 
> > version of Tomcat (i.e. jakarta-tomcat-5). Since this is a very new 
> > workspace, it seems the safest place to make the switch (messing with 
> > Tomcat 4.x seems too risky to me). This would eliminate the need to put 
> > in a Tomcat-specific class into commons-logging.
> > 
> > What do you think?
> 
> $ cd jakarta-tomcat-4.0
> $ grep -i -l 'void.*log(' `find . -name *.java`|wc -l
>      65
> 
> Looks like 65 classes need to be beaten into using commons-logging.  I
> will take a stab at this and see if it is simply cut/past/click/drag or
> if other nasty issues start popping up.  Learn by doing, yippie. :-)

I have learned that, IMHO, Tomcat does a pretty decent job with logging
all on it's own.  

Where the "issue" arises is getting Tomcat to use commons-logging. The
only "issue" is correctly unrolling the stack. (Namely that a wrapper
class is being used.)  

A simple change to commons-logging is to pass it a hint, (per costin)

  factory=LogFactory.getFactory();
   
  factory.setAttribute( "commons-logging.wrapperClass", 
                        "[CLASSNAME-OF-WRAPPER]");

  factory.getLog().info("Hi mom");


This hint could be used by both the Log4j and Jdk1.4 loggers to provide
better class name and method name information to the log.

I think this small change makes commons-logger a better fit for Tomcat.
And probably for many projects.

Cheers,
-bob





--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message