I am implementing a custom XML formatter for log4.net
public class ISDSApplicationEventsLayout : XmlLayoutBase
{
protected override void FormatXml(...)
{
//Location Info
writer.WriteStartElement("Method");
writer.WriteString(**loggingEvent.LocationInformation.MethodName * *);
writer.WriteEndElement();
}
}
The problem is ... now when I call log method from my log wrapper class... called logging
public static void logEvent(string message)
{
log.Info(isdsLog);
}
I get the output....
<Method>logEvent</Method>
How is it possible to have the method name that called logEvent, rather than logEvent as the method name?
Thank you
Question Update:
If this above seems a bit complicated - what I am really asking is : How do you keep the context of the method that called the wrapping logging function in log4net...
example... method doWork()... calls -> logging wrapper --> calls log4net....
How do you make the methodname = doWork and NOT logging wrapper function....