Event Log Categories

Topics: Logging Application Block
Nov 5, 2007 at 8:44 PM
I'm using Ent Lib 1.1 Logging Block. When I write to Event Log Sink, I'd also like to populate Category column in Event Viewer.
I've created CategoryMessages.dll and added CategoryMessageFile and CategoryCount values for my Event Source registry key.
However, I don't see how to specify CategoryId thru Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write();

When I say CategoryId, I mean CategoryId specified in CategoryMessageFile, not the one in loggingdistributorconfiguration.config.

If it's not possible to do with 1.1, is it supported with later versions of Ent Lib? If yes, can you point to sample?

Thank you.
Nov 6, 2007 at 11:30 AM

The Event Log API in the .NET v1.1 framework doesn't even support categories. The .NET v2.0 version added support for categories, but EntLib is not using this functionality (and neither is the framework's EventLogTraceListener).

There is no public sample AFAIK. I explored using this functionality but I couldn't figure out how to make it fit just right, other than configuring mappings from event IDs to categories in the new event log's configuration; Category ids are an Event Log specific parameter, so they don't really belong to the facade's API.