Using Event Logs

Event logs are a centralized means in the Windows platform to keep track of diagnostic information about running software components in the system. Both the operating system and its services and third-party applications can plug in to it. The designers of the .NET Framework deemed it useful to have a managed wrapper around the APIs used to communicate with the event logging component of Win32.

The EventLog class in System.Diagnostics is the wrapper class for event logs exposed to managed code. Various static methods are available to create what’s known as an event source, basically an identifier to correlate an event log entry with its origin. In addition, methods such as WriteEntry and WriteEvent are available to write to a ...

Get C# 4.0 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.