CustomAppendar中LoggingEvent中的LocationInformation [英] LocationInformation in LoggingEvent in CustomAppendar

查看:108
本文介绍了CustomAppendar中LoggingEvent中的LocationInformation的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了custon Appendar,并重写了Append方法.我在该方法中获取LoggingEvent,但是当我查看LocationInformation为空时,它仅显示?".在以下属性中.

I have written custon Appendar and override Append method. I am getting LoggingEvent in that method but when I looked at LocationInformation it is empty it shows only "?" in following properties.

protected override void Append(log4net.Core.LoggingEvent loggingEvent)
{

ClassName = loggingEvent.LocationInformation.ClassName /*contains "?"*/,
MethodName = loggingEvent.LocationInformation.MethodName /*contains "?"*/,
FileName = loggingEvent.LocationInformation.FileName /*contains "?"*/,
FullInfo = loggingEvent.LocationInformation.FullInfo /*contains "?"*/,

}

我做错了什么?

谢谢

推荐答案

您能否尝试在自定义附加程序的构造函数中添加以下行:

Could you try adding following line in the constructor of your custome appender:

Fix = FixFlags.All;

这篇关于CustomAppendar中LoggingEvent中的LocationInformation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆