开发者

Log4j messages containing (?:method:?) instead of class name

开发者 https://www.devze.com 2023-02-20 04:59 出处:网络
My log4j messages are not including the class names: [INFO] 22:41 (?: decodeDirectory :?) Any idea why that would be so?

My log4j messages are not including the class names:

[INFO] 22:41 (?: decodeDirectory :?)

Any idea why that would be so?

log4j.properties reads like so:

log4j.rootLogger=INFO, logfile, console

log4j.appender.logfile=org.apache.log4j.RollingFileAppender
log4j.appender.logfile.File=ExifImageRA.log
log4j.appender.logfile.MaxFileSize=1MB
log4j.appender.logfile.MaxBackupIndex=1
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout开发者_开发知识库
log4j.appender.logfile.layout.ConversionPattern=[%5p] %d{mm:ss} (%F:%M:%L)%n%m%n%n

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=[%5p] %d{mm:ss} (%F:%M:%L)%n%m%n%n


It looks like what is actually missing from your log messages are the source file name (%F) and the line number (%L).

  • According to the javac Ant task: the debug attribute "[i]ndicates whether source should be compiled with debug information; defaults to off. If set to off, -g:none will be passed on the command line ... ".

  • According to the javac manual, the source filename and line numbers are omitted from the .class file if you compile with javac -g:none.

Hence, your log message lossage is a direct consequence of removing debug="true" from the javac task in your Ant build file.

0

精彩评论

暂无评论...
验证码 换一张
取 消