logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Billy Barnum" <b.bar...@comcast.net>
Subject RE: How to log EventID with EventLogAppender?
Date Fri, 23 Sep 2005 21:10:18 GMT
That doesn't look to bad, you're correct. But I'll have to read in the SDK
about use of these ThreadContext properties; I'm still too new around here
to see how such properties pass through to an EventLog.WriteEntry() or
whatever. Thank you once again.

As long as you're asking: yes, I propose that eventID is such an integral
part of writing to Windows event logs that it should be exposed more easily.
I think a single integer parameter would be sufficient; after all the
resource which EventLogAppender wraps only accepts integers.


-----Original Message-----
From: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
Sent: Friday, September 23, 2005 1:43 PM
To: Log4NET User
Subject: RE: How to log EventID with EventLogAppender?

The extension folder name may be misleading. The implementation isn't
very complex:

public void Info(int eventId, object message, System.Exception t)
 if (this.IsInfoEnabled)
  LoggingEvent loggingEvent =  new LoggingEvent(...);
  loggingEvent.Properties["EventID"] = eventId;

You could do basically the same thing using the normal ILog interface:

log4net.ThreadContext.Properties["EventId"] = 5;
log.Info("Hello World");
 log.Info("Hello World");

How do you propose this functionality be made part of the core? Do you
think the ILog interface members should be modified to accept a single
integer parameter? What if someone's EventId is a float, GUID, or a


View raw message