Linus,
In the standard event schema we shipped with EIF, the EventLogEntryTypeID
is a private property of CommonEvent (from which other events are derived).
This is set by different events in different ways in their constructor.
For instance, here's the constructor of the ErrorEvent:
protected ErrorEvent()
{
EnabledDefault = true;
EventLogEntryTypeID = (int)EventLogEntryType.Error;
}
So this gets set here to an error event type. Typically the kind of event
class determines which event-log event type ID to use, but if you want more
control than this, you can create your own customized event schema from the
source code of the standard event schema, as described in the help docs.
You could add additional .Raise() overloads to an event with an
EventLogEntryTypeID parameter that sets this property when the event is
fired.
You can't filter raising an event by a particular property of the event.
EIF filters by event category and event sink. You can create your own
event categories containing different sets of event types (or even just one
event type), but you can't filter the same event two different ways
depending on the value of a property on that event. Note that downstream,
you can use WMI subscriptions to do this level of filtering, but it's
usually not appropriate for high-speed eventing as this filtering is done
much later.
--------------------
| From: linus@technologist.com (Linus)
| Newsgroups: microsoft.public.vsnet.enterprise.tools
| Subject: EIF and Trace Switch...
| Date: 17 Oct 2003 17:57:13 -0700
| Organization:
http://groups.google.com | Lines: 18
| Message-ID: <501d83a1.0310171657.318afcdf@posting.google.com>
| NNTP-Posting-Host: 67.121.119.195
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1066438634 12238 127.0.0.1 (18 Oct 2003
00:57:14 GMT)
| X-Complaints-To: groups-abuse@google.com
| NNTP-Posting-Date: Sat, 18 Oct 2003 00:57:14 +0000 (UTC)
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onlin
e.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!postnews1.google.com!no
t-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.vsnet.enterprise.tools:1199
| X-Tomcat-NG: microsoft.public.vsnet.enterprise.tools
|
| Hi,
|
| How can I enable/disable raising an event in EIF based on the
| EventLogEntryTypeID and have it work like the trace switch? And
| further more, how can I specify the EventLogEntryTypeID (to identity
| whether the event is an error or warning or informartion) when raising
| an event?
|
| The problem is that I don't know how to set the
| EventLogEntryTypeID of an event, therefore, every event I raise is
| shown either as Error, Information or Audit, but never Warning. Also,
| a developer can raise all sorts of events in the code but I want to
| control what type of events get logged (e.g., only Warnings get
| logged) in runtime.
|
| Thanks for your help.
|
| -Linus
|