Project Files
Project Description
This example demonstrates how to configure customize the name and GUID of the ETW event source.
The custom log source is implemented in the MyEventSource class. This class must fulfill the following requirements:
- Inherit the
PostSharpEventSourceclass - Be annotated with the
EventSourceandGuidcustom attributes. - Contain a set of predefined methods annotated with an
Eventcustom attribute. You can change the method name or any parameter of theEventcustom attribute, but you can change nor theeventIdparameter and nor the signature of the method for this specific event. These methods exist for the sole purpose of defining the event metadata. They are never invoked directly.
An instance of the new event source class is passed to the constructor of EventSourceLoggingBackend.
Viewing the log
To view the log produced by this example, you need to attach a log collector:
Download PerfView from https://www.microsoft.com/en-us/download/details.aspx?id=28567.
Execute: perfview.exe collect -OnlyProviders:*MyEventSource
Execute this program.
In PerfView, click 'Stop collecting', then in the PerfView tree view click 'PerfViewData.etl.zip' and finally 'Events'.