I would like to keep track event logs in my asp.net website..
i.e. Writing exception errror and other information..
I'm very new to this, If somebody explains me how to : Create Event Source, EventEntry, Write Entry and etc would be more useful..
Regards
Lokesh
Marcus LagerPosted Nov 7, 2008, 7:39 AM
Writing to Windows event log is quite easily achieved:
using System.Diagnostics;
...
// Create the source, if it does not already exist.
if(!EventLog.SourceExists("MySource")){
EventLog.CreateEventSource("MySource", "MyNewLog");
Console.WriteLine("CreatingEventSource");
}
// Create an EventLog instance and assign its source.
EventLog myLog = new EventLog();
myLog.Source = "MySource";
// Write an informational entry to the event log.
myLog.WriteEntry("Writing to event log.");
More info here:
http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog(VS.80).aspx