Windows Event Log

The Windows event log provides a centralized, remotely accessible mechanism for the operating system and applications to log events. By default, the event log contains three separate logs: Application, System, and Security.

Access to the event log is exposed through the System.Diagnostics.EventLog class. EventLog provides a mixture of static and instance members used to read from and write to the event log as well as create, delete, and clear individual logs.

Writing to the Event Log

Registering an Event Source

Before an application can write to the event log, an event source must be configured and registered against a particular log; a source is a string that uniquely identifies a component and is usually the application name.

Get C# for Java Developers now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.