Mercurial > hg > Blog
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4cd9b65e10e4 |
---|---|
1 Title: Log4j based logging in Tomcat 6 | |
2 Date: 2008-06-14 | |
3 Tags: logging, log4j, Tomcat | |
4 Lang: en | |
5 | |
6 My favourite annoyance in Tomcat is its logging to the ever-growing, never-rotated `catalina.out`. | |
7 | |
8 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. | |
9 | |
10 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. | |
11 | |
12 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. | |
13 | |
14 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. |