If you have an appender declared like so in a properties file:
log4j.appender.LOGFILE=org.apache.log4j.FileAppender
log4j.appender.LOGFILE.File=file.log
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%d %-5p %c - %m%n
Then what you want to add is
log4j.appender.LOGFILE.Append=false
The default value is true
.
So, if you are declaring your appenders programmatically, then what you want to do is call setAppend(false)
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…