Log4j .append=true property fail

2019-05-09 17:51发布

问题:

I am using log4j (2.1.16) with a DailyRollingFileAppender, with the append property set to true. However, everytime I restart the web application it does not append, it simply overwrites the file.

log4j.appender.eformsAccess=org.apache.log4j.DailyRollingFileAppender 
log4j.appender.eformsAccess.file=to be set in the code(SchemeActionBean.java)
log4j.appender.eformsAccess.datePattern='.'yyyyMMdd
log4j.appender.eformsAccess.append=true
log4j.appender.eformsAccess.ImmediateFlush=true
log4j.appender.eformsAccess.layout=org.apache.log4j.PatternLayout
log4j.appender.eformsAccess.layout.ConversionPattern=%d{ISO8601} %m %n

So what am I doing wrong?

cheers

回答1:

I guess there are some case-sensitive typos. "File" and "Append" starts with a capital:

log4j.appender.eformsAccess.File=someFileNamePlease.log
log4j.appender.eformsAccess.Append=true


标签: java log4j