How to create and delete custom event logs in Windows using C# .NET Framework? In my latest project, I need to have a custom Windows event log to keep track of all the bugs reported by my applications. Therefore, I created an application to create this custom event log file.

First of all, you need to have using System.Diagnostics; We need to use System.Diagnostics namespace to create or remove custom event logs.

Codes to create custom event logs

EventLog.CreateEventSource(“ApplicationName”, “LogName”);

These codes will create an event log called ‘LogName’ and EventSource as ‘ApplicationName’.

Codes to delete custom event logs

EventLog.Delete(“LogName”);

Hope this will help… ;)

Related Entries