[logback-user] Using logback in tomcat

Ceki Gülcü listid at qos.ch
Tue Jan 2 10:22:55 CET 2007


Hello Michael,

Comments inline.

At 02:26 PM 12/28/2006, Michael Abato wrote:

>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.

Excellent news. Thank you for letting us know.

>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...

Sounds reasonable. I'll let Sebastien make the change.

>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?

What is ACL?

We made a quick and unsuccessful attempt at directing tomcat's
internal logs to logback. So, we could not decently recommend a
solution which does not work for us.


>If there's interest, I can tidy up my tomcat patch and post the details.

Yes, we are definitely interested.

Happy new year,


-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch




More information about the Logback-user mailing list