LocationInformation in LoggingEvent in CustomAppendar
-
18-04-2021 - |
سؤال
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 "?"*/,
}
What I am doing wrong ?
Thanks
المحلول
Could you try adding following line in the constructor of your custome appender:
Fix = FixFlags.All;
نصائح أخرى
Set the Fix Property on the LoggingEvent in the Append-Method:
protected override void Append(LoggingEvent loggingEvent)
{
loggingEvent.Fix = FixFlags.All;
var className = loggingEvent.LocationInformation.ClassName;
// ...
}
لا تنتمي إلى StackOverflow