tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Tomcat log files
Date Tue, 09 Nov 2010 21:06:14 GMT
Hash: SHA1


On 11/9/2010 1:48 PM, Timothy Lam wrote:
> I'm trying to clean up Tomcat logging to use log4j.  I've read the
> Tomcat logging guide that comes with my version of Tomcat 6.0.28.


> I'm really confused with all the different log files that are being 
> generated in the default Tomcat before log4j configuration.  Why are 
> there so many different log files: admin, manager, localhost, 
> manager, host-manager, catalina log files and then System.out and 
> System.err get appended to catalina.out? What's the purpose of each 
> of these log files?

So, the log files for "admin", "manager", and "host-manager" are
application-specific log files. Anything the application sends to
ServletContext.log() will go to these files. The "localhost" log is for
anything emitted by the <Host name="localhost"> and catalina.out is
exclusively for stdout and stderr, and is done via shell redirection (so
you shouldn't see any configuration for it anywhere other than

All of these are configured in conf/, though they may
not have a ton of explanation as to /why/ they are configured the way
they are. You are free to change any of this configuration -- for
instance, to remove the manager, host-manager, and admin log files. I
would recommend not deploying any unused webapps, and enabling logging
for any webapps you actually do use.

> When I configure log4j in tomcat I will have
> this single tomcat.log file but will that contain everything in the
> default log files that I previously listed in addition to
> catalina.out?

It should.

- From the docs:

You can (and should) be more picky about which packages to include in
the logging. Tomcat defines loggers by Engine and Host names. For
example, for a more detailed Catalina localhost log, add this to the end
of the above. Note that there are known issues with
using this naming convention (with square brackets) in log4j XML based
configuration files, so we recommend you use a properties file as
described until a future version of log4j allows this convention.[Catalina].[localhost]=DEBUG

If you read a bit more about log4j (not covered by the Tomcat docs, of
course), you'll find that you can set up logging for different
applications by using different appenders like this:


If you repeat this for each of the default loggers defined for the JULI
configuration (which you are replacing with log4j), you'll get the same
setup. I'm not sure why the documentation doesn't show an equivalent
configuration for log4j. Maybe I'll write one and submit it for inclusion.

> Or will I need to use both tomcat.log and catalina.out
> to get a full picture of all of my logging?

catalina.out will always include whatever goes to stdout/stderr: the use
of log4j won't change that.

> I tried to delete the
> file in my Tomcat 6.0.28 and I get a
> NoClassDefFoundException in doing so. isn't supposed to be necessary, but I seem to recall
some issue with the shell scripts choking when logging wasn't completely
configured correctly. Have you correctly replaced lib/tomcat-juli.jar
and installed lib/tomcat-juli-adapters.jar? If not, you may be falling
back to the old logger which requires

> So there doesn't seem to be
> any way of really removing java.util.logging from Tomcat in v6.0.28.

Yes, it can be done. If it's still not working, please post your entire and a directory listing of CATALINA_HOME/lib and

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message