System EVENLOG for logging

if you are planning to use system even viewer for loging purpose. then,below piece of code will work for you!!

if(System.Diagnostics.EventLog.SourceExists(“Application“))
   {
     this.eventLog.Source = “Application“;
     this.eventLog.Log = “Application“;
     this.eventLog.WriteEntry(“This is Warning for evenlog!!”, EventLogEntryType.Warning);
     this.eventLog.WriteEntry(“This is Information for evenlog!!”, EventLogEntryType.Information);
     this.eventLog.WriteEntry(“This is Error for evenlog!!”, EventLogEntryType.Error);
   }

below is the screen shot from event viewer with logging details.

Thanks,
Md. jawed


http://pagead2.googlesyndication.com/pagead/show_ads.js

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