Mercurial > hg > Blog
view content/Java/log4j-based-logging-in-tomcat-part1.md @ 78:21fd84209125
Blog post about switching to the pelican comment system
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Wed, 06 Jan 2016 16:43:18 +0100 |
parents | 4cd9b65e10e4 |
children |
line wrap: on
line source
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.