我在 Tomcat 7 中运行的 webapp 重复相同的日志消息 6 次。例如:
[INFO] 1
29042 [http-nio-8443-exec-4] INFO com.lni.exchange.healthvault.ParseMeasurement - 1
29042 [http-nio-8443-exec-4] INFO com.lni.exchange.healthvault.ParseMeasurement - 1
29042 [http-nio-8443-exec-4] INFO com.lni.exchange.healthvault.ParseMeasurement - 1
29042 [http-nio-8443-exec-4] INFO com.lni.exchange.healthvault.ParseMeasurement - 1
29042 [http-nio-8443-exec-4] INFO com.lni.exchange.healthvault.ParseMeasurement - 1
29042 [http-nio-8443-exec-4] INFO com.lni.exchange.healthvault.ParseMeasurement - 1
预期的书面输出只是第一行([INFO] 1),但随后我收到了 6 次重复该消息。有谁知道为什么该消息重复了这么多次?可能弄乱了我的 log4j 属性,这一直让我有点困惑。
我有一个使用 Spring 的 Axis2 1.6.2 部署,它接收数据并将其发送到 HealthVault。
这是 log4j 属性文件:
# Set root category priority to INFO and its only appender to CONSOLE.
#log4j.rootCategory=INFO, CONSOLE
log4j.rootCategory=INFO, CONSOLE, LOGFILE
# Set the enterprise logger priority to FATAL
log4j.logger.org.apache.axis2.enterprise=FATAL
log4j.logger.de.hunsicker.jalopy.io=FATAL
log4j.logger.httpclient.wire.header=FATAL
log4j.logger.org.apache.commons.httpclient=FATAL
# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=[%p] %m%n
# LOGFILE is set to be a File appender using a PatternLayout.
log4j.appender.LOGFILE=org.apache.log4j.FileAppender
log4j.appender.LOGFILE.File=axis2.log
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n