一个实用程序来压缩旋转的日志文件吗? [英] A utility to compress rotated log files?

查看:115
本文介绍了一个实用程序来压缩旋转的日志文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用NLog进行日志记录,并且需要在创建后不久将生成的旋转文本文件进行压缩.

I'm using NLog for logging and need to zip the loads of rotated text files it's generating shortly after they are created.

NLog应该在未知的将来支持此功能,但是是否有某种实用程序可以独立执行此操作?

NLog should support this feature some time in the unknown future, but is there a utility of sorts that can do this independently ?

推荐答案

自NLog 4.0开始支持压缩存档文件,请参见

Zipping archive files is supported since NLog 4.0, see news post

使用enableArchiveFileCompression,例如

<target name="file" xsi:type="File"
      layout="${longdate} ${logger} ${message}" 
      fileName="${basedir}/logs/logfile.txt" 
      archiveFileName="${basedir}/archives/log.{#}.txt"
      archiveEvery="Day"
      archiveNumbering="Rolling"
      maxArchiveFiles="7"
    enableArchiveFileCompression="true" />

这篇关于一个实用程序来压缩旋转的日志文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆