tags:

views:

61

answers:

0

I'm using Log4Net - with a little wrapper around it - kind of similar to this: http://stackoverflow.com/questions/166438/what-would-a-log4net-wrapper-class-look-like

What I want to be able to do, is specify the Source in the windows event log (using EventLogAppender)

Example:

[EventLogName("My Little Test Program")]
class Program
{
    static void Main(string[] args)
    {
        MyLogger.Current.Write("testing - ", LogMessageType.Info, typeof(MailsToSendManager));
    }
 }

My idea was to do something like this: http://stackoverflow.com/questions/571876/best-way-to-dynamically-set-an-appender-file-path

And in my .Write method on my wrapper, detect if the calling class had this attribute? How could I detect that? System.Reflection I'm sure... but not sure what to do...?

Is there a better way?