[logback-user] problems with TimeBasedRollingPolicy

Leon Rosenberg rosenberg.leon at gmail.com
Tue Jun 28 14:13:21 CEST 2011


Hello,

I have following logback rolling file appender configuration:


	<appender name="DWHTextToolActionLogger"
		class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>${user.home}/data/inbound/csi/text_approval/xxx_text_approval.csv</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>${user.home}/data/inbound/csi/text_approval/xxx_text_approval_%d{yyyy_MM_dd}.csv.gz</fileNamePattern>
			<maxHistory>100</maxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>%m%n</pattern>
		</encoder>
	</appender>

	<logger name="DWHTextToolActionLogger" additivity="false">
		<level value="INFO" />
		<appender-ref ref="DWHTextToolActionLogger" />
	</logger>

I would expect the log file to roll nightly, however, I only see
following files:


-rw-r--r-- 1 xxx xxx 236K Jun 28 14:08 xxx_text_approval.csv
-rw-r--r-- 1 xxx xxx  39K Jun 22 08:21 xxx_text_approval_2011_06_21.csv.gz
-rw-r--r-- 1 xxx xxx  32K Jun 23 08:18 xxx_text_approval_2011_06_22.csv.gz
-rw-r--r-- 1 xxx xxx  35K Jun 24 07:52 xxx_text_approval_2011_06_23.csv.gz
-rw-r--r-- 1 xxx xxx  26K Jun 25 07:43 xxx_text_approval_2011_06_24.csv.gz
-rw-r--r-- 1 xxx xxx  41K Jun 26 07:50 xxx_text_approval_2011_06_25.csv.gz
-rw-r--r-- 1 xxx xxx  28K Jun 27 07:44 xxx_text_approval_2011_06_26.csv.gz
-rw-r--r-- 1 xxx xxx  57K Jun 28 08:12 xxx_text_approval_2011_06_27.csv.gz

Is it misconfigured, or does the rolling actually happens at the first
log message in the morning?
If it's action based, how can i configure rolling to be triggered
@midnight no matter how empty or full the log is?

regards
Leon

p.s.
version:
                             <groupId>ch.qos.logback</groupId>
                                <artifactId>logback-classic</artifactId>
                                <version>0.9.28</version>


More information about the Logback-user mailing list