With the following Log4j configuration
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=sample.log
log4j.appender.R.DatePattern='.'yyyy-MM-dd
The sample.log will be copied to sample.log.2006-06-06, example,
sample.log
sample.log.2006-06-06
sample.log.2006-06-05
---------------------------------------------------------------------------------
- name="Rolling" class="org.apache.log4j.RollingFileAppender">
- name="file" value="${catalina.home}/logs/test.log" />
- name="maxFileSize" value="10000KB" />
- name="maxBackupIndex" value="25" />
- class="org.apache.log4j.PatternLayout">
- name="ConversionPattern" value="[%t] %d{HH:mm:ss,SSS} %-5p %l - %m%n" />
-
------------------------------------------------------------------------------------
- name="Daily" class="org.apache.log4j.DailyRollingFileAppender">
- name="file" value="${catalina.home}/logs/test.log" />
- name="DatePattern" value="'.'yyyy-MM-dd" />
- name="MaxBackupIndex" value="10" />
- class="org.apache.log4j.PatternLayout">
- name="ConversionPattern" value="[%t] %d{HH:mm:ss,SSS} %-5p %l - %m%n" />
-
-
No comments:
Post a Comment