log4j.properties配置如下
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG, A1
# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%r %d{yyyy-MM-dd HH\:mm\:ss} %c %p -%m%n
两个问题
- 为什么前面会多处个数字?有时候是1,有时候是2?
- 为什么日志会打印两遍?
%r: 输出自应用启动到输出该log信息耗费的毫秒数