Cool cheers I'll take a look. Found what I was looking for in log4net too.
Annoyingly we've started using Castle Logging Facility which only seems to take a string to an xml file! So may have to consider doing it all via DSL and generating our xml configs as a pre build step.
private static void ConfigureLog()
{
var root = ((Hierarchy)LogManager.GetRepository()).Root;
root.AddAppender(GetConsoleAppender());
root.AddAppender(GetFileAppender(@"d:\dev\huddle\log\Huddle.Sync", "standard.log", Level.Debug));
root.AddAppender(GetFileAppender(@"d:\dev\huddle\log\Huddle.Sync", "error.log", Level.Warn));
root.Repository.Configured = true;
}
private static FileAppender GetFileAppender(string directory, string fileName, Level threshold)
{
var appender = new FileAppender
{
Name = "File",
AppendToFile = true,
File = directory + @"\" + fileName,
Layout = new PatternLayout(_pattern),
Threshold = threshold
};
appender.ActivateOptions();
return appender;
}
private static ConsoleAppender GetConsoleAppender()
{
var appender = new ConsoleAppender
{
Name = "Console",
Layout = new PatternLayout(_pattern),
Threshold = Level.Debug
};
appender.ActivateOptions();
return appender;
}