压缩Log4j文件 [英] Compress Log4j files
本文介绍了压缩Log4j文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以压缩日志文件(我通过RollingFileAppender进行压缩)?
Is it possible to compress log files (I doing it via RollingFileAppender )?
推荐答案
log4j extras 支持:
只需将以下内容添加到您的RollingFileAppender配置并且文件名以 .gz 结尾将自动压缩您的日志文件:
just add the following to your RollingFileAppender configuration and having the filename end in .gz will automagically compress your logfiles:
<appender...>
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="/wombat/foo.%d{yyyy-MM}.gz"/>
</rollingPolicy>
</appender>
点击此处查看javadoc中的一些详细信息:
check here for some details in the javadoc:
希望有帮助
这篇关于压缩Log4j文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文