*author 谭剑
##################################################################################################################
在Apache官方网站上已声明,对于Tomcat6.0的版本,把<logger>元素嵌套在<Context>元素中不再合法.
原文如下:
An important consequence for Tomcat 6.0 is that the <Logger> element found in previous versions to create a localhost_log is no longer a valid nested element of <Context>. Instead, the default Tomcat configuration will use java.util.logging. If the developer wishes to collect detailed internal Tomcat logging (i.e what is happening within the Tomcat engine), then they should configure a logging system such as java.util.logging or log4j as detailed next.
详细见(http://tomcat.apache.org/tomcat-6.0-doc/logging.html).
但是要使用tomcat的logger也并非不可能,只是有点繁琐.
1.Create a file called log4j.properties with the following content and save it into $CATALINA_HOME/lib.
log4j.rootLogger=debug, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=${catalina.home}/logs/tomcat.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
log4j.logger.org.apache.catalina=DEBUG, R
2.Download Log4J (v1.2 or later) and place the log4j jar in $CATALINA_HOME/lib.
3.Build or download the additional logging components. See the extras components documentation for details.
4.Replace $CATALINA_HOME/bin/tomcat-juli.jar with output/extras/tomcat-juli.jar.
5.Place output/extras/tomcat-juli-adapters.jar in $CATALINA_HOME/lib.
6.Start Tomcat
##################################################################################################################