Can NLog be configured to automatically prune/trim a log file after it reaches a certain file size?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With