示例#1
0
 private void AddError(LogEvent e, Exception err)
 {
     if (err != null)
     {
         e.Errors.Add(new EventMessage { Message = err.Message, StackTrace = err.StackTrace });
         err = err.InnerException;
         while (err != null)
         {
             e.Errors.Add(new EventMessage { Message = err.Message, StackTrace = err.StackTrace });
             err = err.InnerException;
         }
     }
 }
示例#2
0
        protected override void Append(log4net.Core.LoggingEvent loggingEvent)
        {
            try
            {
                LogEvent le = new LogEvent();
                le.ErrorTime =loggingEvent.TimeStamp.ToString("yyyy-MM-dd HH:mm:ss");
                le.EventType = loggingEvent.Level.ToString();
                le.Message = loggingEvent.RenderedMessage;
                le.AppName = AppName;
                le.ServerTag = ServerTag;
                le.ErrorType = loggingEvent.ExceptionObject != null ? loggingEvent.ExceptionObject.GetType().ToString() : "未知错误类型";
                AddError(le, loggingEvent.ExceptionObject);
                Add(le);

            }
            catch (Exception e_)
            {
                LogLog.Error(declaringType, e_.Message);
            }
        }
示例#3
0
 private void Add(LogEvent item)
 {
     CreateTime();
     lock (mEvents)
     {
         mEvents.Enqueue(item);
         if (mEvents.Count > MaxRecords)
             Upload(null);
     }
 }