The error message is as follows:
log4j:WARN No such property [maxBackupIndex] in org.apache.log4j.DailyRollingFileAppender.
log4j:WARN No such property [maxFileSize] in org.apache.log4j.DailyRollingFileAppender.
According to the error prompt, we can see that the class DailyRollingFileAppender does not have the attributes maxBackupIndex and maxFileSize. It saves logs by date, so there is no need to set these two attributes. If you want to set the size of the log file, you can extend the RollingFileAppender class , you need to pay attention to the settings in the log configuration file during development.
Configure as follows:
#The following is the log file configuration
#-----------------------------------This sentence is defined as R2 The output is the file
log4j.appender.R2=org.apache.log4j.FileAppender
#-------------------------------- ---Generate a log file every day
#log4j.appender.R2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R2=org.apache.log4j.RollingFileAppender
#--------------- --------------------- Maximum file size
log4j.appender.R2.MaxFileSize=500KB
#--------------- --------------------Maximum number of log files
log4j.appender.R2.MaxBackupIndex=50
#---------------- -------------------
log4j.appender.R2.append=true
#-------------------------------- --------------PatternLayout layout should specify the specific format of printing information
log4j.appender.R2.layout=org.apache.log4j.PatternLayout
#-----------------------------------PatternLayout layout will specify the specific format of the print information
log4j.appender .R2.layout.ConversionPattern= %d{yyyy MM dd HH\:mm\:ss}-%p %t %c - %m%n
#---------------- ------------------- Logging Charset
log4j.appender.R2.Encoding=UTF-8
#--------------- -------------------- Specify the log file name and path
log4j.appender.R2.File=app.log
Log4j Getting Started Tutorial http://www.linuxidc.com/Linux/2013-06/85223.htm
Log4j log detailed usage http://www.linuxidc.com/Linux/2014-09/107303.htm
Hibernate configure Log4j to show SQL parameters http://www.linuxidc.com/Linux/2013-03/81870.htm
Log4j Study Notes (1)_Log4j Basics & Configuration Item Analysishttp : //www.linuxidc.com/Linux/2013-03/80586.htm
Log4j study notes (2)_Log4j configuration example & Spring integrated Log4j http://www.linuxidc.com/Linux/2013-03/80587.htm
Detailed introduction of Log4j : please click here
Log4j download address : please click here