Freigeben über


Raise Crimson Events from Managed Code Part 1

You may have heard there is a new event logging API on the block. Its codename is Crimson and it rocks.

Haven't heard of Crimson? Check out the .NET Show on Management Services at https://blogs.msdn.com/theshow/archive/2005/07/06/436242.aspx. Also see https://windowssdk.msdn.microsoft.com/library/default.asp?url=/library/en-us/wes/wes/about_the_windows_event_log.asp?frame=true (and its worth checking out https://msdn.microsoft.com/windowsvista/top10/#CTA5 for the bigger picture in Vista)

If you were at PDC, you will also have seen Crimson in action.

So I thought it would be good to show how to raise crimson events from .NET (using C# and .NET 2.0 beta 2!)

So here is the plan based "loosely" upon https://windowssdk.msdn.microsoft.com/library/default.asp?url=/library/en-us/wes/wes/developing_event_publishers.asp :

  1. Create an Instrumentation Manifest - this contains the definitions for the channels, events etc.
  2. Build/Register the Manifest - the channels/events need installing and we need a DLL.
  3. Wrap the API in .NET - Since the new event log does not have .NET support, we need to either use "backwards compatibility" or P/Invoke. We'll use P/Invoke.
  4. Raise Event - and view it in the event viewer!

Over the next day or two I'll be explaining how to do this.

This posting is provided "AS IS" with no warranties, and confers no rights.