[logback-user] Auto archiving log files

Stevo Slavić sslavic at gmail.com
Thu Dec 30 14:59:35 CET 2010


Hello Logback users,

If I understood docs well, it's enough to end FileNamePattern with
.zip or .gz and it will automtically get archived when rottated
(TimeBasedRollingPolicy). Is that true? If yes, than something else
must be preventing it to work as expected on my setup. All I see along
with log files for each day, a file is created e.g.
"webapp.log2456797635721192.tmp" with different numbers after
"webap.log", and it's a text file - no zip file gets created. I'm
using latest logback, 0.9.27, see appender definition [1]. Does anyone
have idea what could be the problem?

Regrads,
Stevo.


[1] appender definition
	<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<File>/var/log/tomcat6/webapp.log</File>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<FileNamePattern>webapp.%d{yyyy-MM-dd}.log.zip</FileNamePattern>
		</rollingPolicy>

		<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
			<Pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] %-5level
%logger{35} - %msg%n</Pattern>
		</encoder>
	</appender>


More information about the Logback-user mailing list