有没有办法让Log4j-outputs包含消息的来源? 通过log4j.properties进行了以下配置(已经移交给我......):
log4j.rootCategory=INFO, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-5p - %m%n
无法打印出发送该消息的类的非常重要的细节,而现在我真的需要那些信息!
Layna
答案 0 :(得分:2)
例如,您可以使用ConversionPattern =%d {ABSOLUTE}%5p%t%c {1}:%M:%L - %m%n
答案 1 :(得分:0)
If you use the %C
notation, you can see the package and the class name of the log origin.
So, you can use:
log4j.rootCategory=INFO, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-5p - %m%n - %C