logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: TimeBasedRollingPolicy with hourly filenames not getting compressed
Date Wed, 07 Jan 2009 23:47:42 GMT

On Jan 7, 2009, at 5:17 PM, agEE wrote:

>
> I am using log4j.1.2.15 and the rollever works fine. But i am not  
> able to get
> the files to compress. Has any one succeed in getting the
> RollingFileAppender/ TimeBasedRollingPolicy  to work correctly.
>

There are unit tests that check this behavior, but they  
programmatically configure log4j.  You have not specified a file name  
pattern, if you specify one that ends in ".gz" or ".zip", it should be  
compressed on rollover.  Try adding the following line:

> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
>
> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
>  <appender name="console" class="org.apache.log4j.ConsoleAppender">
>
>    <layout class="org.apache.log4j.PatternLayout">
>
>    </layout>
>  </appender>
>
>  <appender name="ROLL"
> class="org.apache.log4j.rolling.RollingFileAppender">
>
>    <rollingPolicy  
> class="org.apache.log4j.rolling.TimeBasedRollingPolicy">


           <param name="fileNamePattern" value="something-%d{yyyy-MM- 
dd}.gz"/>

>
>
>    </rollingPolicy>
>    <layout class="org.apache.log4j.PatternLayout">
>
>    </layout>
>  </appender>
> <root>
>    <priority value ="debug" />
>    <appender-ref ref="console" />
>    <appender-ref ref="ROLL"/>
>  </root>
>
> </log4j:configuration>
>
>
> thanks in advance.
> AG



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message