Esempio n. 1
0
        private static OutputDebugStringAppender GetOutputDebugStringAppender(PatternLayout patternLayout)
        {
            OutputDebugStringAppender outputDebugStringAppender = new OutputDebugStringAppender();

            outputDebugStringAppender.Layout    = patternLayout;
            outputDebugStringAppender.Threshold = Level.All;
            outputDebugStringAppender.ActivateOptions();
            return(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"));
        }