[logback-dev] [JIRA] Commented: (LBCORE-146) SiftingAppender TimeBasedRollingPolicy MaxHistory not deleting old files

Hrotkó Gábor (JIRA) noreply-jira at qos.ch
Fri Feb 3 22:44:26 CET 2012


    [ http://jira.qos.ch/browse/LBCORE-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12354#action_12354 ] 

Hrotkó Gábor commented on LBCORE-146:
-------------------------------------

with 1.0.0 and this config:

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>../logs/mylog.log</file>
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <pattern>${TIMESTAMP} [%thread] %level %logger.%method:%line - %msg%n</pattern>
        </encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>../logs/mylog.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>50MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>61</maxHistory> <!-- ~2 months -->
        </rollingPolicy>
    </appender>

it works!

> SiftingAppender TimeBasedRollingPolicy MaxHistory not deleting old files
> ------------------------------------------------------------------------
>
>                 Key: LBCORE-146
>                 URL: http://jira.qos.ch/browse/LBCORE-146
>             Project: logback-core
>          Issue Type: Bug
>          Components: Rolling
>    Affects Versions: 0.9.18
>         Environment: linux64, jdk1.6.0_17-b04, apache-tomcat-6.0.24
>            Reporter: Hrotkó Gábor
>            Assignee: Logback dev list
>
> When I use SiftingAppender with TimeBasedRollingPolicy, old files does not get deleted when the MaxHistory is set. 
> logback.xml snipet:
> <configuration debug="true" scan="true" scanPeriod="5 seconds">
>   <appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">
>     <discriminator>
>       <Key>userid</Key>
>       <DefaultValue>base</DefaultValue>
>     </discriminator>
>     <sift>
>       <appender name="FILE-${userid}" class="ch.qos.logback.core.rolling.RollingFileAppender">
>         <File>/usr/local/tomcat6/logs/myLog_${userid}.log</File>
>         <Append>false</Append>
>         <layout class="ch.qos.logback.classic.PatternLayout">
>           <Pattern>%d [%thread] %level %mdc %logger.%method:%line - %msg%n</Pattern>
>         </layout>
>         <RollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>           <FileNamePattern>/usr/local/tomcat6/logs/myLog_${userid}.%d{yyyy-MM-dd}.log</FileNamePattern>
>           <!-- not working -->
>           <MaxHistory>2</MaxHistory>
>         </RollingPolicy>
>       </appender>
>     </sift>
>   </appender>
> ...
> With the config above, the files gets sifted and rolled well, but old files not deleted.
> When I change the filenames, and delete the ${userid} sifting, it works well.
> ...
> <File>/usr/local/tomcat6/logs/myLog.log</File>
> ...
> <FileNamePattern>/usr/local/tomcat6/logs/myLog.%d{yyyy-MM-dd}.log</FileNamePattern>
> ...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       


More information about the logback-dev mailing list