Пример #1
0
        public void SanityCompressed()
        {
            var hierarchy      = (Hierarchy)LogManager.GetRepository(Assembly.GetCallingAssembly());
            var logzioAppender = new LogzioAppender();

            logzioAppender.AddToken("123456789");
            logzioAppender.AddListenerUrl(_dummy.DefaultUrl);
            logzioAppender.AddGzip(true);
            logzioAppender.ActivateOptions();
            hierarchy.Root.AddAppender(logzioAppender);
            hierarchy.Configured = true;
            var logger = LogManager.GetLogger(typeof(Log4netSanityTests));

            logger.Info("Just a random log line");

            LogManager.Shutdown();  // Flushes and closes

            _dummy.Requests.Count.ShouldBe(1);
            _dummy.Requests[0].Body.ShouldContain("Just a random log line");
            _dummy.Requests[0].Headers["Content-Encoding"].ShouldBe("gzip");
        }