public void Init()
        {
            _mockLogClient = new MockLogClient();
            Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();

            _appender = new StackifyAppender { CreateLogClient = (s, s1) => _mockLogClient, threadContextKeys = "TestThreadContext", logicalThreadContextKeys = "TestLogicalThreadContext" };
            _appender.ActivateOptions();
            hierarchy.Root.AddAppender(_appender);

            hierarchy.Root.Level = Level.Info;
            hierarchy.Configured = true;
            Console.WriteLine("Setup Log4Net");
        }
        public void Init()
        {
            _mockLogClient = new MockLogClient();
            Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();

            _appender = new StackifyAppender {
                CreateLogClient = (s, s1) => _mockLogClient, threadContextKeys = "TestThreadContext", logicalThreadContextKeys = "TestLogicalThreadContext"
            };
            _appender.ActivateOptions();
            hierarchy.Root.AddAppender(_appender);

            hierarchy.Root.Level = Level.Info;
            hierarchy.Configured = true;
            Console.WriteLine("Setup Log4Net");
        }
Esempio n. 3
0
        public static async Task <HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
        {
            var stackifyAppender = new StackifyAppender();

            stackifyAppender.ActivateOptions();
            log4net.Config.BasicConfigurator.Configure(stackifyAppender);

            var body = await req.Content.ReadAsStringAsync();

            using (var scope = _serviceProvider.BeginLifetimeScope(b => b.RegisterInstance(log)))
            {
                var processor = scope.Resolve <FunctionProcessor>();
                processor.Process(body);
            }

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }