[logback-user] Auto archiving log files

Stevo Slavić sslavic at gmail.com
Sat Jan 8 23:42:30 CET 2011


Ah, full path has to be specified in FileNamePattern even if it is
same as for log File - not DRY. Expected that if in FileNamePattern a
file name without path is specified, same directory as in log file
would be used. This is consistent with case when both File and
FileNamePattern don't contain path elements as both log file and
compressed log file would be stored in same, current working
directory. Is there any reason why that shouldn't be (default)
behavior? Should I file an improvement ticket for this? Couldn't find
existing one.

Regards,
Stevo.

On Thu, Dec 30, 2010 at 2:59 PM, Stevo Slavić <sslavic at gmail.com> wrote:
> 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