[logback-user] Appendere with timeBasedFileNamingAndTriggeringPolicy

MarkIT marcosak85 at gmail.com
Mon Mar 19 16:14:12 CET 2012


Hi everyone, 
I'm trying to create an appender with timeBasedFileNamingAndTriggeringPolicy
but I got some trouble. 
I need to zip log files of previosly month in one .zip file (EX: on
04/01/2012 zip all file of March in one zip file). 

Here my logback.xml files: 

<configuration> 
        
    <property scope="context" name="logFolder" value="log" /> 

    <appender name="ROLLING"
class="ch.qos.logback.core.rolling.RollingFileAppender"> 
        <file>${logFolder}/myLog.log</file> 
        <rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 
            <!-- rollover daily --> 
           
<fileNamePattern>${logFolder}/myLog.log-%d{yyyyMMdd}.%i.log.zip</fileNamePattern> 
            <timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> 
                <maxFileSize>2MB</maxFileSize> 
            </timeBasedFileNamingAndTriggeringPolicy> 
        </rollingPolicy> 
        <encoder> 
            <pattern>%d{dd-MM-yyyy HH:mm:ss:SSS} [%thread] %-5level
%logger{35} - %msg%n</pattern> 
        </encoder> 
    </appender> 

    <root level="DEBUG"> 
        <appender-ref ref="ROLLING" /> 
    </root> 
        
</configuration> 


Where I'm wrong? 
In this way, it zip file when log name change to MyLog_20120319_0.log 

Thanks in advance 
-- 
View this message in context: http://old.nabble.com/Appendere-with-timeBasedFileNamingAndTriggeringPolicy-tp33532352p33532352.html
Sent from the Logback User mailing list archive at Nabble.com.



More information about the Logback-user mailing list