问题
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