[logback-user] Using logback in tomcat

Michael Abato nabble at maengden.org
Thu Dec 28 14:26:58 CET 2006


I'm successfully using logback with Tomcat and have a small suggestion that
will help people with complex deployments: look for logback-access.xml in
system property catalina.base rather than catalina.home.

Tomcat is intentionally setup such that multiple instances (java VMs) can be
running off the same copy of the tomcat distribution and set up private
CATALINA_BASE directories for server config, logs, temp space, etc. Such
setups will naturally want to configure logback in CATALINA_BASE, not in the
(potentially read-only) CATALINA_HOME.

In cases where the user does *not* set CATALINA_BASE, it takes the same
value as CATALINA_HOME (which is generally the same as TOMCAT_HOME).

I've patched the source of LogbackValve.java to do this and it works well.
The change of "catalina.home" to "catalina.base" is to trivial for a formal
patch...

On a related note, I've also configured tomcat to use log4j/logback for
internal logging, which also works quite well. I noticed in a previous post
you "don't recommend this at this time" and would like to know the
reason(s). Routing *all* logging through one logger/one config, which in
turn can separate "live" logs from rotated out "archive" logs in a separate
directory is a godsend.

I'm assuming it is because doing this requires mucking around with the
tomcat startup scripts to replace ACL from the very beginning of the tomcat
boot process. I'd already created a "boot" directory with a dynamic set of
jar's and classes (for unrelated reasons) so switching ACL to log4j/logback
was pretty trivial for me. Is there more to the reluctance than the fact
that there is no "drop in" way to do it?

If there's interest, I can tidy up my tomcat patch and post the details.
-- 
View this message in context: http://www.nabble.com/Using-logback-in-tomcat-tf2890321.html#a8074672
Sent from the Logback User mailing list archive at Nabble.com.




More information about the Logback-user mailing list