Exemple #1
0
        public void GotchaWillTurnOffLoggingAfterDispose()
        {
            ILog log = LogManager.GetLogger("SomeLog");

            With.Log(log.Logger.Name, delegate { });

            //wire up a new appender to listen to log entries
            InMemoryMessageAppender appender = new InMemoryMessageAppender();
            ((Logger)log.Logger).AddAppender(appender);

            log.Info("This messgae will go into the blackhole");

            Assert.IsTrue(appender.Messages.Count == 0);
        }
        public void TestInitialize()
        {
            appender = new InMemoryMessageAppender();
            //all loggers created within these test will inherit our appender we register here
            BasicConfigurator.Configure(appender);

            loggerA = LogManager.GetLogger("LoggerA");
            loggerB = LogManager.GetLogger(GetType());
        }