我只得到一个日志文件。过去的日志被删除。我想要过去的日志文件作为备份。它不应该替换旧内容,而是将旧内容保存在单独的文件中。以下是我的 log4j.properties 文件
# Log4j configuration file.
log4j.rootCategory=DEBUG, A1
# Available levels are DEBUG, INFO, WARN, ERROR, FATAL
#
# A1 is a ConsoleAppender
#
log4j.appender.A1 = org.apache.log4j.RollingFileAppender
log4j.appender.A1.File = C:/LogInfo/logfile.log
log4j.appender.A1.MaxFileSize = 100MB
log4j.appender.A1.MaxBackupIndex=10
log4j.appender.A1.layout = org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern = [%d] %C %M %L - %m%n
log4j.appender.A1.Threshold = DEBUG
#
# A2 is a DailyRollingFileAppender
#
log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A2.file=C:/LogInfo/logfile.log
log4j.appender.A2.datePattern='.'yyyy-MM-dd
log4j.appender.A2.append=true
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=[%d] %C %M %L - %m%n
#
#
# A3 is a RollingFileAppender - Should be used in production only
#
log4j.appender.A3=org.apache.log4j.RollingFileAppender
log4j.appender.A3.file=C:/LogInfo/logfile.log
log4j.appender.A3.append=true
log4j.appender.A3.MaxBackupIndex=5
log4j.appender.A3.MaxFileSize=10MB
log4j.appender.A3.layout=org.apache.log4j.PatternLayout
log4j.appender.A3.layout.ConversionPattern=[%d] %C %M %L - %m%n