Can I configure NLog to prune logs after they reach a certain limit?

会有一股神秘感。 提交于 2020-01-03 06:55:10

问题


Can NLog be configured to automatically prune/trim a log file after it reaches a certain file size?


回答1:


I think the closest you will achieve will be to use the archiveAboveSize attribute to get NLog to archive the log file when it reaches a certain size. By combining this with the maxArchiveFiles attribute, you can keep the number of archived files to a minimum (although I think you will always need one archived file otherwise when the current log file gets archived and replaced with a new one, the now-archived file will be deleted and you will lose all of the logging in it).

There is an example in the documentation.



来源:https://stackoverflow.com/questions/19259993/can-i-configure-nlog-to-prune-logs-after-they-reach-a-certain-limit

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