using System;
using System.Diagnostics;
using System.Threading;
class MySample{
public static void Main()
{
if (!EventLog.SourceExists("MySource"))
{
EventLog.CreateEventSource("MySource", "MyNewLog", "myServer");
return;
}
EventLog myLog = new EventLog("myNewLog", "myServer");
foreach(EventLogEntry entry in myLog.Entries){
Console.WriteLine("\tEntry: " + entry.Message);
}
}
}
|