log4j.properties配置 Windows Tomcat日志输出

【最佳答案】Windows下采用的是Tomcat的相对路径 , 如:C:AppTomcatapache-tomcat-7.0.62logs,即${TOMCAT_HOME}/logslog4j.properties配置2log4j.rootLoggWindows Tomcat日志输出1 Windows下采用的是Tomcat的相对路径 , 如:C:AppTomcatapache-tomcat-7.0.62logs,即${TOMCAT_HOME}/logs

log4j.properties配置2
log4j.rootLogger=INFO, Console,RollingFile, D #Consolelog4j.appender.Console=org.apache.log4j.ConsoleAppenderlog4j.appender.Console.layout=org.apache.log4j.PatternLayoutlog4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n log4j.logger.java.sql.ResultSet=INFOlog4j.logger.org.apache=INFOlog4j.logger.java.sql.Connection=debuglog4j.logger.java.sql.Statement=debuglog4j.logger.java.sql.PreparedStatement=debug### u8f93u51fau65e5u5fd7u5230u6587u4ef6 ### log4j.appender.RollingFile=org.apache.log4j.DailyRollingFileAppenderlog4j.appender.RollingFile.File=logs/fmcgwms.loglog4j.appender.RollingFile.layout=org.apache.log4j.PatternLayoutlog4j.appender.RollingFile.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n### u8f93u51fau5f02u5e38u5230u6307u5b9au6587u4ef6 ### log4j.appender.D = org.apache.log4j.DailyRollingFileAppender log4j.appender.D.File = logs/fmcgwms_error.log ## log4j.appender.D.Append = true log4j.appender.D.Threshold = ERROR log4j.appender.D.layout = org.apache.log4j.PatternLayout log4j.appender.D.layout.ConversionPattern = %d [%t] %-5p [%c] - %m%n%m%n
Linux Tomcat输出日志3 Linux下采用的路径是系统的绝对路径:跟上面log4j配置的路径一致
logs/fmcgwms.log #相当于是/logs/fmcgwms.log

【log4j.properties配置 Windows Tomcat日志输出】