0

对应于 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
4

1 回答 1

1

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

此日期模式不正确:

log4j.appender.R.DatePattern='.'yyyyMMdd
于 2017-09-21T10:57:49.143 回答