Have you seen this:

http://tinyurl.com/dedeu
http://cvs.apache.org/viewcvs.cgi/logging-log4net/extensions/net/1.0/log4net.Ext.EventID/cs/src/

You could use that or extend ILog and make your own interface.

--- "Gargus, Javan (GE Infrastructure)" <[EMAIL PROTECTED]>
wrote:

> Hi all,
> 
> Currently, the EventLogAppender supports configuring the event log
> LogName (event log) and ApplicationName (event source).  It also
> supports logging the EventID by adding a property to the
> LoggingEvent.  However, it does not support logging the event
> category (a short) even though there is a
> System.Diagnostics.EventLog.WriteEvent() method that supports it.
> 
> I was able to get event categories supported with little effort and I
> was wondering if it would be possible to include this feature in
> future releases.  My team would like to use this feature, but some
> people are resistant to maintaining a modified version of log4net. 
> :-\
> 
> In order to get <category value="1" /> working for the
> EventLogAppender configuration, I had to:
> 1. create a public (string) property, Category, and a private
> (string) field, m_category, to EventLogAppender
> 2. add some code to Append() (Similar code is used earlier in the
> function to convert the event ID):
> 
> short category = 0;
> int intVal;
> if ((m_category != null) && SystemInfo.TryParse(m_category, out
> intVal))
> {
>   category = (short) intVal;  
> }
> 
> 3. modify a line in Append() (or add an if/else block):
> change:
> EventLog.WriteEntry(m_applicationName, eventTxt, entryType, eventID);
> to:
> EventLog.WriteEntry(m_applicationName, eventTxt, entryType, eventID,
> category);
> 
> 
> As you can see, the change is fairly straightforward.  I hope it is
> something that you can add to a future release.  Thanks for your
> time!
> 
> Javan Gargus
> Software Developer, GE Fanuc
> [EMAIL PROTECTED]
> 

Reply via email to