本文整理汇总了C#中log4net.Core.LoggingEvent.GetLoggingEventData方法的典型用法代码示例。如果您正苦于以下问题:C# LoggingEvent.GetLoggingEventData方法的具体用法?C# LoggingEvent.GetLoggingEventData怎么用?C# LoggingEvent.GetLoggingEventData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类log4net.Core.LoggingEvent
的用法示例。
在下文中一共展示了LoggingEvent.GetLoggingEventData方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
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);
}
示例2: Append
protected override void Append(LoggingEvent loggingEvent)
{
if (OnLog != null)
{
OnLog(string.Format("{0,-5} {1}", loggingEvent.GetLoggingEventData().Level, loggingEvent.MessageObject));
}
}
示例3: Append
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);
}
示例4: Append
protected override void Append(LoggingEvent loggingEvent)
{
base.Append(loggingEvent);
var handler = AppendedFile;
if (handler != null)
{
handler(this, new LoggingDataEventArgs(loggingEvent.GetLoggingEventData()));
}
}
示例5: PutToOvermind
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);
}
示例6: JsonLoggingEventData
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");
}
示例7: JsonLoggingEventData
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;
}
示例8: Append
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));
}
示例9: Append
/// <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);
}