-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Timothy,
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. Excellent. > 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 bin/catalina.sh). All of these are configured in conf/logging.properties, 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 log4j.properties 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. log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=DEBUG log4j.logger.org.apache.catalina.core=DEBUG log4j.logger.org.apache.catalina.session=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: log4j.appender.LOCALHOST=org.apache.log4j.FileAppender log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=LOCALHOST 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 > logging.properties file in my Tomcat 6.0.28 and I get a > NoClassDefFoundException in doing so. logging.properties 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 logging.properties. > 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 log4j.properties and a directory listing of CATALINA_HOME/lib and CATALINA_HOME/conf. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkzZt8YACgkQ9CaO5/Lv0PBnSACgv0iBGYspjkELcUEMIUGLGUg6 paMAnRmYmi9lNydjZ/3Z2fMo4z2wcXiK =T7Fb -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org