For task requirements, the output log needs to be saved as file name + date format.
The workaround is simple:
Log4j.appender.file=org.apache.log4j.dailyrollingfileappender
#log4j. Appender.file.file=hibernate.log
Log4j.appender.file.file=. /logs/Log_
Log4j.appender.file.datepattern=yyyy-mm-dd '. txt ' #后缀可为. txt/. Log/. HTML, etc.
Log4j.appender.file.layout=org.apache.log4j.patternlayout
LOG4J.APPENDER.FILE.LAYOUT.CONVERSIONPATTERN=[%-5P]%d{yyyy-mm-dd Hh:mm:ss,sss} method:%l%n%m%n
The output file name is Log_, check the information, if the day's words, the file name for the moment is log_, and want to be named like "Log_20150724.txt" such a log file, when the time is over the day, such as 25th, will save the previous file as Log_ 20150724.txt, and then create a 25th Log_ file, and so on.
Therefore, you need to modify the system time to see the generated log when testing.