The Enterprise Instrumentation Framework (EIF) provides an easy-to-use and unified API for writing trace messages out to any and all event sinks including: the event log, WMI, text files, MSMQ, etc.
by Mike Snell
Nov 26, 2003
Page 3 of 5
The EIF in Action
To output messages to event sinks (listeners like the event log) with the EIF you simply call the static Raise method of the TraceMessageEvent class as follows:
This one line API call makes good on the promise of a simple instrumentation API.
The next step is to generate (or create) a configuration file. This configuration file will allow you (or the administrator of your application) to turn on and off the output and capturing of trace messages in your application. Like all config files in .NET, this file is XML. Let's take a quick look at the details of the XML contained in this file:
Event Sources: Used to indicate the source (or provider) of the trace message (application is the intrinsic event source)
This configuration file is generated and manipulated for us at design time by the EIF. You will undoubtedly want to modify this configuration file yourself and perhaps share a common configuration file across your application. In addition, you may want to leverage the configuration API provided by the EIF to expose the contents of this file to editing by the system administrators.
Now let's take a look at what our one line API call output to the event log. Figure 1provides a graphical depiction of the trace message inside the event log.