diff content/Java/log4j-based-logging-in-tomcat-part1.md @ 0:4cd9b65e10e4

initial import of the pelican based blog
author Dirk Olmes <dirk@xanthippe.ping.de>
date Fri, 28 Jun 2013 08:48:58 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/content/Java/log4j-based-logging-in-tomcat-part1.md	Fri Jun 28 08:48:58 2013 +0200
@@ -0,0 +1,14 @@
+Title: Log4j based logging in Tomcat 6
+Date: 2008-06-14
+Tags: logging, log4j, Tomcat
+Lang: en
+
+My favourite annoyance in Tomcat is its logging to the ever-growing, never-rotated `catalina.out`.
+
+The [Tomcat logging setup instructions](http://tomcat.apache.org/tomcat-6.0-doc/logging.html) already contain a description what to do to make Tomcat log through log4. This is definitely a step in the right direction. Tomcat's logging is properly separated from each webapp's logging and only output written to `System.out` will end up in catalina.out.
+
+For hosting third party jars I originally also wanted a mechanism that caputres `System.out` and `System.err` and pipes it through commons-logging also. This is to avoid that some misbehaving webapp fills up catalina.out again.
+
+After a lot of poking around with commons-logging, the package rewritten commons-logging called *Juli* in Tomcat and a simple sample webapp that writes to `System.out` I came to the conclusion that the best you can get is what's described in Tomcat's logging setup.
+
+Since Tomcat has code in place to redirect `System.out` and `System.err` to `catalina.out`, there is no easy way to do custom commons-logging initialization after Tomcat redirected System.out and System.err.