A utility to compress rotated log files?

可紊 提交于 2019-12-10 14:44:50

问题


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 should support this feature some time in the unknown future, but is there a utility of sorts that can do this independently ?


回答1:


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

Use enableArchiveFileCompression, e.g.

<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" />


来源:https://stackoverflow.com/questions/8594550/a-utility-to-compress-rotated-log-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!