ETW EventSource Name at runtime
I would like to know, if we can set EventSource Name during runtime.
[EventSource(Name = "Test-SourceLogger")]
public sealed class EventSourceLogger : EventSource
I have multiple applications who wants to log to different EventSources. If this can be made configurable i can reuse the component for EventViewer.
Additional information on EventSourceAttribute
[AttributeUsage(AttributeTargets.Class)]
public sealed class EventSourceAttribute : Attribute
Thanks in advance.
I am able to generate this class using CodeDom and use appropriately. Thanks for your inputs.
You can pass event source name through constructor of the instance of your EventSource. Every new instance can have different event source name. Just do not use singleton pattern.
链接地址: http://www.djcxy.com/p/90862.html