Is it possible to compress log files (I doing it via RollingFileAppender )?
question from:https://stackoverflow.com/questions/3329385/compress-log4j-filesIs it possible to compress log files (I doing it via RollingFileAppender )?
question from:https://stackoverflow.com/questions/3329385/compress-log4j-fileslog4j extras has support for that.
Just add the following to your RollingFileAppender
configuration and have the filename end in .gz to automagically compress your log files:
<appender...>
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="/wombat/foo.%d{yyyy-MM}.gz"/>
</rollingPolicy>
</appender>
For more details check the Javadoc