Exemplo n.º 1
0
        public void Update(HttpContextBase context, LoggingEvent loggingEvent)
        {
            if (loggingEvent == null)
            {
                throw new ArgumentNullException("loggingEvent");
            }
            LoggingEventData data = loggingEvent.GetLoggingEventData();
            Exception exception = loggingEvent.ExceptionObject;
            string requestUrl = GetRawUrl(context);

            var json = new
            {
                date = data.TimeStamp.ToInvariantString(),
                thread = data.ThreadName,
                level = data.Level.DisplayName,
                logger = data.LoggerName,
                message = data.Message,
                exception = exception == null ? null : new
                {
                    message = exception.Message,
                    stackTrace = exception.StackTrace,
                    sql = exception.Data["SQL"]
                },
                requestUrl
            };
            hub.Context.Clients.update(json);
        }
Exemplo n.º 2
0
 protected override void Append(LoggingEvent loggingEvent)
 {
     if (OnLog != null)
     {
         OnLog(string.Format("{0,-5} {1}", loggingEvent.GetLoggingEventData().Level, loggingEvent.MessageObject));
     }
 }
 protected override void Append(LoggingEvent loggingEvent)
 {
     var newData = loggingEvent.GetLoggingEventData();
     newData.Message = Decorate(newData.Message);
     loggingEvent.GetType()
         .GetField("m_data", BindingFlags.NonPublic | BindingFlags.Instance)
         .SetValue(newData, loggingEvent);
     base.Append(loggingEvent);
 }
Exemplo n.º 4
0
        protected override void Append(LoggingEvent loggingEvent)
        {
            base.Append(loggingEvent);

            var handler = AppendedFile;
            if (handler != null)
            {
                handler(this, new LoggingDataEventArgs(loggingEvent.GetLoggingEventData()));
            }
        }
Exemplo n.º 5
0
        private void PutToOvermind(LoggingEvent loggingEvent)
        {
            var parameters = GetParameters(loggingEvent);

            LoggingEventData data = loggingEvent.GetLoggingEventData();
            DroneLogDto dto = Mapper.Map<LoggingEventData, DroneLogDto>(data);
            dto.Parameters = parameters;

            var client = new MvcClient();
            client.Request(Config.Wcf.OvermindApi.PostLog, dto);
        }
 public JsonLoggingEventData(LoggingEvent loggingEvent)
 {
     var loggingEventData = loggingEvent.GetLoggingEventData(Flags);
     Domain = loggingEventData.Domain;
     ExceptionString = loggingEventData.ExceptionString;
     Level = loggingEventData.Level.DisplayName;
     LoggerName = loggingEventData.LoggerName;
     Message = loggingEventData.Message;
     Properties = loggingEventData.Properties;
     ThreadName = loggingEventData.ThreadName;
     TimeStamp = loggingEventData.TimeStamp.ToString("u");
 }
 public JsonLoggingEventData(LoggingEvent loggingEvent)
 {
     LoggingEventData loggingEventData = loggingEvent.GetLoggingEventData();
     this.Domain = loggingEventData.Domain;
     this.ExceptionString = loggingEventData.ExceptionString;
     this.Identity = loggingEventData.Identity;
     this.Level = new JsonLevel(loggingEventData.Level);
     this.LocationInfo = new JsonLocationInfo(loggingEventData.LocationInfo);
     this.LoggerName = loggingEventData.LoggerName;
     this.Message = loggingEventData.Message;
     this.Properties = loggingEventData.Properties;
     this.ThreadName = loggingEventData.ThreadName;
     this.TimeStamp = loggingEventData.TimeStamp;
     this.UserName = loggingEventData.UserName;
 }
Exemplo n.º 8
0
        protected override void Append(LoggingEvent loggingEvent)
        {
            var loggingEventData = loggingEvent.GetLoggingEventData();

            if (loggingEventData.Message.Contains(ParameterStart))
            {
                var messageBuilder = new StringBuilder();

                var message = loggingEventData.Message;
                var queries = Regex.Split(message, @"command\s\d+:");

                foreach (var query in queries)
                {
                    messageBuilder.Append(ReplaceQueryParametersWithValues(query));
                }

                loggingEventData.Message = messageBuilder.ToString();
            }

            base.Append(new LoggingEvent(loggingEventData));
        }
Exemplo n.º 9
0
    /// <summary>
    /// Writes the logging event to the zeromq publisher socket.
    /// </summary>
    /// <param name="logging_event">
    /// The event to log.
    /// </param>
    /// <remarks>
    /// The event is not writted to the zeromq publisher socket immediatelly,
    /// instead, we store it in a memory and returns. A dedicated thread (
    /// possibly from the thead pool) is the responsible to remove the logging
    /// event from the memory and dispatch to the zeromq socket.
    /// </remarks>
    protected override void Append(LoggingEvent logging_event) {
      LoggingEventData logging_event_data = logging_event.GetLoggingEventData();

      #region : logging :
      if (LogLog.IsDebugEnabled) {
        LogLog.Debug(declaring_type_, "Appending\r\n"
          + "message:" + logging_event_data.Message
            + "timestamp:" +
              logging_event_data.TimeStamp.ToString("yyyy-mm-dd hh:MM:ss")
                + "level:" + logging_event_data.Level);
      }
      #endregion

      LogMessage message = new LogMessage.Builder()
        .SetLevel(logging_event_data.Level.ToString())
        .SetMessage(logging_event_data.Message)
        .SetException(logging_event_data.ExceptionString)
        .SetTimeStamp(TimeUnitHelper.ToUnixTime(logging_event_data.TimeStamp))
        .Build();
      mailbox_.Send(message);
    }
Exemplo n.º 10
0
        protected override void Append(log4net.Core.LoggingEvent loggingEvent)
        {
            LoggingEvent copied = new LoggingEvent(loggingEvent.GetLoggingEventData());

            ParentAppender.Append(copied);
        }