C# Event Log

By admin - Last updated: Saturday, November 1, 2003 - Save & Share - Leave a Comment
using System.Diagnostics;
public void WriteEventLog(string appName, string logDetail)
{
 if (!System.Diagnostics.EventLog.SourceExists(appName))
  System.Diagnostics.EventLog.CreateEventSource(appName,"Application");

  EventLog EventLog1 = new EventLog();
  EventLog1.Source = appName;
  EventLog1.WriteEntry (logDetail, EventLogEntryType.Error);
}



Posted in Code Notes • • Top Of Page