Esempio n. 1
0
        private void SendLogAction(LoggingEvent loggingEvent)
        {
            //we should always format event in the same thread as
            //many properties used in the event are associated with the current thread
            //like threadname, ndc stacks, threadcontent properties etc.

            //initializing a string for the formatted log
            string _formattedLog = string.Empty;

            //if Layout is null then format the log from the Loggly Client
            if (this.Layout == null)
            {
                Formatter.AppendAdditionalLoggingInformation(Config, loggingEvent);
                _formattedLog = Formatter.ToJson(loggingEvent);
            }
            else
            {
                _formattedLog = Formatter.ToJson(RenderLoggingEvent(loggingEvent), loggingEvent.TimeStamp);
            }

            //check if logMode is bulk or inputs
            if (Config.LogMode == "bulk/")
            {
                addToBulk(_formattedLog);
            }
            else if (Config.LogMode == "inputs/")
            {
                //sending _formattedLog to the async queue
                LogglyAsync.PostMessage(_formattedLog, Config);
            }
        }
Esempio n. 2
0
        private void SendLogAction(LoggingEvent loggingEvent)
        {
            //we should always format event in the same thread as
            //many properties used in the event are associated with the current thread
            //like threadname, ndc stacks, threadcontent properties etc.

            //initializing a string for the formatted log
            string _formattedLog = string.Empty;

            //if Layout is null then format the log from the Loggly Client
            if (this.Layout == null)
            {
                Formatter.AppendAdditionalLoggingInformation(Config, loggingEvent);
                _formattedLog = Formatter.ToJson(loggingEvent);
            }
            else
            {
                _formattedLog = Formatter.ToJson(RenderLoggingEvent(loggingEvent), loggingEvent.TimeStamp);
            }

            //sending _formattedLog to the async queue
            ThreadPool.QueueUserWorkItem(x => Client.Send(Config, _formattedLog));
        }
Esempio n. 3
0
        protected override void Append(LoggingEvent loggingEvent)
        {
            // We should always format event in the same thread as
            // many properties used in the event are associated with the current thread.

            // if user defined layout let it render the message based on layout, otherwise get message from event
            var renderedMessage = Layout != null
                ? RenderLoggingEvent(loggingEvent)
                : loggingEvent.RenderedMessage;

            var formattedLog = _formatter.ToJson(loggingEvent, renderedMessage);

            if (formattedLog != null)
            {
                _buffer.BufferForSend(formattedLog);
            }
        }
Esempio n. 4
0
 protected override void SendBuffer(LoggingEvent[] loggingEvents)
 {
     Client.Send(Config, Formatter.ToJson(loggingEvents));
 }
Esempio n. 5
0
 protected override void Append(LoggingEvent loggingEvent)
 {
     Formatter.AppendAdditionalLoggingInformation(Config, loggingEvent);
     Client.Send(Config, Config.InputKey, Config.UserAgent, Config.Tag, Formatter.ToJson(loggingEvent));
 }
Esempio n. 6
0
 private void SendLogAction(LoggingEvent loggingEvent)
 {
     Formatter.AppendAdditionalLoggingInformation(Config, loggingEvent);
     Client.Send(Config, Formatter.ToJson(loggingEvent));
 }
Esempio n. 7
0
 protected override void SendBuffer(LoggingEvent[] loggingEvents)
 {
     Client.Send(Config, Config.InputKey, Config.UserAgent, Config.Tag, Formatter.ToJson(loggingEvents));
 }