Log4j RollingFileAppender未知错误

时间:2017-09-21 10:38:54

标签: spring rabbitmq log4j log4jdbc

与log4j对应的错误。

log4j:WARN No such property [datePattern] in org.apache.log4j.RollingFileAppender.
log4j:WARN No such property [datePattern] in org.apache.log4j.RollingFileAppender.
log4j:WARN No such property [datePattern] in org.apache.log4j.RollingFileAppender.

log4j.properties有两个文件。 一个是在资源中,另一个是放在一个单独的目录中。 我把他们两个结合起来。

我的log4j.properties文件:

log4j.rootLogger=INFO,R
log4j.logger.org.apache.activemq=INFO
log4j.logger.org.apache.activemq.broker.TransportConnection=INFO
log4j.logger.org.springframework=INFO
log4j.logger.medagate=DEBUG
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=./logs/medagateRabbitMQ.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=30
log4j.appender.R.DatePattern='.'yyyy-MM-dd
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d %-5p [%c{1}] %m%n
log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer
log4j.rootLogger=INFO, out, R
log4j.logger.org.apache.camel.impl.converter=INFO
log4j.logger.org.apache.camel.util.ResolverUtil=INFO
log4j.logger.org.apache.activemq.broker.TransportConnection=WARN
log4j.logger.org.springframework=WARN
log4j.logger.org.hibernate=WARN
log4j.logger.net.lshift.camel.component.rabbitmq=DEBUG
log4j.logger.maxim=DEBUG
log4j.appender.out=org.apache.log4j.ConsoleAppender
log4j.appender.out.layout=org.apache.log4j.PatternLayout
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=./logs/medagateRabbitMQ.log
log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.DatePattern='.'yyyyMMdd
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer

1 个答案:

答案 0 :(得分:1)

根据https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html

此日期模式不正确:

log4j.appender.R.DatePattern='.'yyyyMMdd