Created
July 19, 2011 15:58
-
-
Save chrisortman/1092889 to your computer and use it in GitHub Desktop.
Configure rolling file logging for nlog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SimpleConfigurator.ConfigureForTargetLogging( | |
new NLog.Targets.FileTarget() | |
{ | |
FileName = "${specialfolder:MyDocuments}/logs/" + filename + ".${shortdate}.txt", | |
Layout = new NLog.Layouts.SimpleLayout("${longdate} [${level:uppercase=true}] [${threadid}] ${callsite} - ${message}"), | |
ArchiveFileName = "${specialfolder:MyDocuments}/logs/archived/" + filename + ".{#####}.txt", | |
ArchiveAboveSize = 10000000 /* 10 MB */, | |
ArchiveNumbering = ArchiveNumberingMode.Sequence, | |
ConcurrentWrites = true, | |
KeepFileOpen = false, | |
MaxArchiveFiles = 50, | |
}, | |
LogLevel.Debug | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment