My Thoughts & Views

Adding Errors to Event Log

Posted on: March 27, 2007

using System.Diagnostics;

private void AddLog(string sErrSource, string sErrMessage, EventLogEntryType ErrType)
{
EventLog objLog = new EventLog(“AppLog”);
objLog.Source=sErrSource;
objLog.WriteEntry(sErrMessage,ErrType);
}
This function will create an event log called “AppLog” and adds the source and message into that.
EventLogEntryType enum contains
1. Error
2. FailureAudit
3. Information
4. SuccessAudit
5. Warning

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: