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 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.