tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Chaffee <>
Subject Re: Tomcat Logging
Date Wed, 23 Aug 2000 10:57:35 GMT
Ceki -

Thanks for the thorough reply.

Yes, it's important to keep the ability to maintain multiple log
files. One target architecture for Tomcat is an ISP hosting hundreds
of different webapps for different clients; with multiple log files
(one per webapp) the admin can maintain security (so people can't read
each other's logs).

I'm wary of the NDC approach; as you said, since Tomcat uses thread
pooling, it would require activity before and after each request.
This would surely have some impact on performance (especially if it
requires allocating new objects -- a main part of the performance
tuning Costin's doing is minimizing GC).

The per-context or per-component category idea seems more sound.
Again, it would only solve the output side of things (#3 on my
original list); we'd still have to write Tomcat code to handle 

1. configuration (though I can imagine with a bit of cleverness we
could delegate most or all of the log config out of server.xml and
into log4j's config file)

2. standardizing the way a component knows which category/target to
write to. This could be as simple as a string property (instance
variable) with log4j category, or maybe an interface, something like

 interface LogAware {
  void setLogTarget(String category);

or, better:

 interface LogAware {
  void setLogger(Logger l);

 interface Logger {
  void setCategory(String category);	// for writing directly to a log4j category
  void setMaster(Logger logger);	// for delegating to a parent
  void log(String msg);
  // etc.

and then appropriate helper and impl classes, and implementing it in
all components.)

3. regulating "debug" level (so a component won't even execute the
code that builds the debug log strings -- which may involve some heavy
lifting -- this simply can't be handled by library code in Java)

and probably some more things I've forgotten :-)

 - Alex

P.S. This is fun!  It's really helping me flesh out my understanding
of the issues.  Hopefully, even if we don't use log4j with Tomcat, we
can each help the other's product get stronger...

Alex Chaffee             
jGuru - Java News and FAQs
Creator of Gamelan       
Founder of Purple Technology
Curator of Stinky Art Collective

View raw message