请问为什么日志会打印2次?
环境配置如下:spring3 hibernate4 Apache Tomcat/7.0.47 JDK1.7.0.59
log4j 1.2.17
使用spring MVC,关于log4j的web.xml地方配置如下:
<context-param>
<param-name>log4jConfigLocation</param-name>
<!-- 开发环境 -->
<param-value>classpath:properties/development/log4j.properties</param-value>
<!-- 生产环境 -->
<!-- <param-value>classpath:properties/production/log4j.properties</param-value> -->
<!-- 测试环境 -->
<!-- <param-value>classpath:properties/testing/log4j.properties</param-value> -->
</context-param>
<!-- Spring的log4j监听器 -->
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
log4j.properties配置如下:
log4j.rootLogger=debug, Console, test, Spring, Hibernate
#log4j.appender.rootlog=org.apache.log4j.DailyRollingFileAppender
#log4j.appender.rootlog.file=../logs/All.log
#log4j.appender.rootlog.layout=org.apache.log4j.PatternLayout
#log4j.appender.rootlog.Append=true
#log4j.appender.rootlog.DatePattern='-'yyyy-MM-dd'.log'
#log4j.appender.rootlog.layout=org.apache.log4j.PatternLayout
#log4j.appender.rootlog.layout.ConversionPattern=%-5d [%-4p] [%r] [%t] [%l] - %m%n
#Console
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.Target=System.out
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%-5d [%-4p] [%r] [%t] [%l] - %m%n
#test
log4j.logger.test=debug,Mall
log4j.appender.test=org.apache.log4j.DailyRollingFileAppender
log4j.appender.test.File=../logs/test.log
log4j.appender.test.Append=true
log4j.appender.test.DatePattern='-'yyyy-MM-dd'.log'
log4j.appender.test.layout=org.apache.log4j.PatternLayout
log4j.appender.test.layout.ConversionPattern=%-5d [%-4p] [%r] [%t] [%l] - %m%n
原来tomcat的日志都往catania.out打印,非常不方便,改造后,日志能按要求在tesg.log记录了,但是里面的日志内容都是双份。
如:
而且catania.out中也会有日志。请教下如何能不打印双份日志记录,并且catania.out也不记录业务日志了,可以记录tocmat启动的信息,tomcat配置没做什么改动,它仍然输出localhost和manager日志