10/28/09

Create Event Viewer Log with System.Diagnostics.EventLog


Here's some code that will log a message in an event viewer:


EventLog EventLog1 = new System.Diagnostics.EventLog();

if (!EventLog.SourceExists("Name"))
EventLog.CreateEventSource(
"Name", "Application");

EventLog1.Source = "Name";
EventLog1.WriteEntry(message.ToString(), EventLogEntryType.Error);

0 comments:

Post a Comment

 

Organic Custom Software Copyright © 2008 D'Black by Ipiet's Blogger Template