public static void Configure() { Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository(); hierarchy.Root.RemoveAllAppenders(); PatternLayout defaultPatternLayout = new PatternLayout(); defaultPatternLayout.ConversionPattern = DefaultLogPattern; defaultPatternLayout.ActivateOptions(); RollingFileAppender rollingFileAppender = GetRollingFileAppender(defaultPatternLayout); hierarchy.Root.AddAppender(rollingFileAppender); EventLogAppender eventLogAppender = GetEventLogAppender(defaultPatternLayout); hierarchy.Root.AddAppender(eventLogAppender); OutputDebugStringAppender outputDebugStringAppender = GetOutputDebugStringAppender(defaultPatternLayout); hierarchy.Root.AddAppender(outputDebugStringAppender); PatternLayout consolePatternLayout = new PatternLayout(); consolePatternLayout.ConversionPattern = ConsoleLogPattern; consolePatternLayout.ActivateOptions(); ColoredConsoleAppender coloredConsoleAppender = GetColoredConsoleAppender(consolePatternLayout); hierarchy.Root.AddAppender(coloredConsoleAppender); hierarchy.Root.Level = Level.All; hierarchy.Configured = true; }
private static OutputDebugStringAppender GetOutputDebugStringAppender(PatternLayout patternLayout) { OutputDebugStringAppender outputDebugStringAppender = new OutputDebugStringAppender(); outputDebugStringAppender.Layout = patternLayout; outputDebugStringAppender.Threshold = Level.All; outputDebugStringAppender.ActivateOptions(); return(outputDebugStringAppender); }
public ReplicationBase() { for (int i = 0; i < 15; i++) { database::Raven.Database.Extensions.IOExtensions.DeleteDirectory("Data #" + i); } var outputDebugStringAppender = new OutputDebugStringAppender { Layout = new SimpleLayout(), }; outputDebugStringAppender.AddFilter(new LoggerMatchFilter { AcceptOnMatch = true, LoggerToMatch = "Raven.Bundles" }); outputDebugStringAppender.AddFilter(new DenyAllFilter()); BasicConfigurator.Configure(outputDebugStringAppender); }
public void Integration() { var rep = LogManager.CreateRepository(Guid.NewGuid().ToString()); var eventAppender = new EventLogAppender { ApplicationName = "xUnit", Layout = new SimpleLayout() }; eventAppender.ActivateOptions(); var stringAppender = new OutputDebugStringAppender { Layout = new SimpleLayout() }; stringAppender.ActivateOptions(); BasicConfigurator.Configure(rep, eventAppender, stringAppender); var logger = LogManager.GetLogger(rep.Name, "LoggerThread"); logger.Error(new Exception("exception test")); }
public ReplicationBase() { for (int i = 0; i < 15; i++) { if (Directory.Exists("Data #" + i)) { Directory.Delete("Data #" + i, true); } } var outputDebugStringAppender = new OutputDebugStringAppender { Layout = new SimpleLayout(), }; outputDebugStringAppender.AddFilter(new LoggerMatchFilter { AcceptOnMatch = true, LoggerToMatch = "Raven.Bundles" }); outputDebugStringAppender.AddFilter(new DenyAllFilter()); BasicConfigurator.Configure(outputDebugStringAppender); }