views:

143

answers:

1

I want to use the Windows Eventing 6 API from a C# application to log messages to a specific channel in Windows Server 2008 event log. There is a good example on how to use it but it's only C++. In the example it's mentioned that .NET doesn't support Windows Eventing 6. There are 2 examples in http://msdn.microsoft.com/en-us/magazine/cc163431.aspx , http://msdn.microsoft.com/en-us/library/aa382690(VS.85).aspx

My question is how to do it in C# or do you know if there is a .Net support for this API.

+1  A: 

I think you ask about ETW stuff.

Check:

Writing events with System.Diagnostics.Eventing

... or, how the hell to use Vista and 2008's new ETW stuff with managed code. And, introducing ecmanaged: A decent way to do all this stuff.

and some more info:

.NET Event Tracing for Windows, Naveen's Blog ETW Series (specificly Using .NET 4.0 Event Tracing for Windows (ETW) along with application ETW), ETW Events in the .NET Framework, TraceEvent

Also some info about regular event logging in case you interested too: EventLog, EventLogInstaller. Example: Event Logging

Nick Martyshchenko