At 02:44 PM 1/10/2004 -0800, you wrote:
Shapira, Yoav wrote:

>1) Is there a reason why the startup.sh script that comes bundled with
>Tomcat 5.0.16 adds commons-logging-api.jar to the CLASSPATH?  As far as
>I can tell, it's the only script that uses it.

Yes, there's a good reason: tomcat internals use commons-logging to do
their logging.

Yes, but why put it in the CLASSPATH and not in /server/lib? Doesn't this mean that any configuration would affect all webapps?

probably, except that Tomcat loads stuff from WEB-INF/lib and WEB-INF/classes before trying from the parent classloaders (opposite of normal Java2 classloading). This is defined by the servlet spec and allows for applications to use their own libs even when the server contains its own duplicates.



>2) Is there a recommended way to control what gets spewed into
>catalina.out?  The fact that all the messages I'm getting have an INFO
>tag would indicate that this should be possible.

Yes, add a commons-logging configuration file to common/classes, e.g. as
suggested in this link off the tomcat FAQ:
http://jakarta.apache.org/tomcat/faq/misc.html#catalina.out

I saw that, and that has a config file for log4j, not commons-logging.
There is no way to actually filter the output through the commons-logging config file. I'd like a way to only suppress catalina's output.
If I use a log4j.properties, it means I'd need to install log4j in /common/lib. It also means that I have to specify all logging config info in /common/classes instead of on a per-webapp basis (see http://www.mail-archive.com/[EMAIL PROTECTED]/msg113292.html).

Well, only if you don't put log4j.jar under WEB-INF/lib. As stated above, if you do this, log4j.jar will load for your webapp even if a common one is available to other webapps. Otherwise, you can also use a custom repositor selector....
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging



>3) In any case, why doesn't Tomcat just come with commons-logging.jar
>and log4j.jar bundled in /server/libs?

Tomcat does not want to tie you into a specific logging implementation,
e.g. log4j.  Tomcat wants to make its logging available to webapps by
default, so server/lib is not a possible location.

But doesn't this just lead to classloader hell?

Sometimes, yes. commons-logging leads to classloader hell on its own no matter where you put it. It's nothing but trouble, if you ask me.
http://www.qos.ch/logging/thinkAgain.html
http://radio.weblogs.com/0122027/2003/08/15.html



>4) Is there a FAQ or HOWTO on recommended approaches to handling
logging
>in Tomcat somewhere?

It won't hurt to search the archives of this list, there are many
answers there.  The link above also has some information.

I'm sorry, but I have searched the archives, and there just doesn't seem to be one conclusive answer. I see a lot of e-mails talking about the use of commons-logging and how it causes all sorts of classloader wierdness.

We get it all too often on the Log4j-user list. Users report "Log4j isn't working" and then proceed to provide a commons-logging config file. There have been very few cases where Log4j itself was causing the problems. I won't say it never does, but commons-logging seems to be the primary cause of issues in getting Log4j to work, not Log4j itself.


What I'm looking for is a way to specify logging configuration for catalina that is independent of any webapps I may have.

I don't want 1 log4j.properties for everything. Is this possible? If so, how? I'd be more than happy to write up a HOW-TO if I could just figure this out, but I haven't stumbled across anything that works yet.

If you follow my advice above, you should be all set. Separate logger repositories for each app, even though you provide log4j and a config file in a parent classloader.


Jake


Thanks,
-Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to