为什么我的log4j属性文件更改没有反映出来?

时间:2019-06-27 11:11:16

标签: log4j

我在资源下有log4j.properties文件。我的日志正在生成。当我尝试更改日志的patternlayout时,其未反映在我的代码中。我不明白怎么了。有人请帮忙。

这是我的log4j-xyz.properties

log4j.appender.importerFile.MaxFileSize=10MB
log4j.appender.importerFile.MaxBackupIndex=10
log4j.appender.importerFile.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.importerFile.layout.ConversionPattern=%throwable{2}

# Direct cli tool log messages to a log file
log4j.appender.cliFile=org.apache.log4j.RollingFileAppender
log4j.appender.cliFile.File=C:\\per-self-service-cli.log
log4j.appender.cliFile.MaxFileSize=10MB
log4j.appender.cliFile.MaxBackupIndex=10
log4j.appender.cliFile.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.cliFile.layout.ConversionPattern=%throwable{2}

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.stdout.layout.ConversionPattern=%throwable{2}

# Log everything. Good for troubleshooting
log4j.logger.org.hibernate=INFO
log4j.logger.liquibase=INFO

# log cfx
log4j.logger.org.apache.cxf=ERROR

# Log all JDBC parameters
log4j.logger.org.hibernate.type=ALL

我这样称呼它

final URL logProperties = MyTestClass.class.getResource("/log4j-xyz.properties");
    PropertyConfigurator.configure(logProperties);

0 个答案:

没有答案