private void InjectInMemoryAppender(Level loggingLevel)
        {
            var appender  = new InMemoryAppender();
            var hierarchy = (Hierarchy)LogManager.GetRepository();

            hierarchy.ResetConfiguration();
            hierarchy.Root.AddAppender(appender);
            hierarchy.Root.Level = loggingLevel;
            appender.ActivateOptions();
            hierarchy.Configured = true;
        }
示例#2
0
        private InMemoryAppender InjectInMemoryAppender()
        {
            var appender  = new InMemoryAppender();
            var hierarchy = (Hierarchy)LogManager.GetRepository();

            hierarchy.ResetConfiguration();
            hierarchy.Root.AddAppender(appender);
            hierarchy.Root.Level = Level.All;
            appender.ActivateOptions();
            hierarchy.Configured = true;
            return(appender);
        }