The gelf 4 net appender.
Inheritance: log4net.Appender.AppenderSkeleton
Ejemplo n.º 1
0
        public void AppendTest()
        {
            var gelfAppender = new Gelf4NetAppender();
            //def logEvent = new LoggingEvent(this.GetType().Name, new Category('catName'), System.currentTimeMillis(), Priority.WARN, "Some Short Message", new Exception('Exception Message'))
            var data = new LoggingEventData
            {
                Domain = this.GetType().Name,
                Level = Level.Debug,
                LoggerName = "Tester",
                Message = "GrayLog4Net!!!",
                TimeStamp = DateTime.Now,
                UserName = "******"
            };

            var logEvent = new LoggingEvent(data);
            gelfAppender.GrayLogServerHost = "public-graylog2.taulia.com";
            gelfAppender.TestAppend(logEvent);
        }
Ejemplo n.º 2
0
        public void AppendTestChunkMessage()
        {
            var gelfAppender = new Gelf4NetAppender();
            //def logEvent = new LoggingEvent(this.GetType().Name, new Category('catName'), System.currentTimeMillis(), Priority.WARN, "Some Short Message", new Exception('Exception Message'))
            var data = new LoggingEventData
            {
                Domain = this.GetType().Name,
                Level = Level.Debug,
                LoggerName = "Big Tester",
                Message = LoremIpsum.Text,
                TimeStamp = DateTime.Now,
                UserName = "******"
            };

            var logEvent = new LoggingEvent(data);
            gelfAppender.GrayLogServerHost = "public-graylog2.taulia.com";
            gelfAppender.MaxChunkSize = 500;
            gelfAppender.AdditionalFields = "nombre:pedro,apellido:jimenez";
            logEvent.Properties["customProperty"] = "My Custom Property";

            gelfAppender.TestAppend(logEvent);
        }