Created
April 21, 2011 05:32
-
-
Save SimonCropp/933770 to your computer and use it in GitHub Desktop.
named loggers in NLog
This file contains 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
public static class LoggingFactory | |
{ | |
static LoggingFactory() | |
{ | |
var name = Assembly.GetEntryAssembly().GetName().Name; | |
var fileTarget = new FileTarget{FileName = string.Format("${{basedir}}/{0}_${{logger}}.log", name),Layout = "${message}"}; | |
var fileRule = new LoggingRule("*", LogLevel.Debug, fileTarget); | |
var config = new LoggingConfiguration(); | |
config.LoggingRules.Add(fileRule); | |
config.AddTarget("file", fileTarget); | |
LogManager.Configuration = config; | |
} | |
public static Logger BuildLogger(string location) | |
{ | |
return LogManager.GetLogger(location); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment