System Event Log Manager

System Event Log Manager

The following code will explain you how to handle the system Event log.
It will show how to write the event log and how to get the event log.

Name Space part

using System;
using System.Resources;
using System.Drawing;
using System.Collections;
using System.Diagnostics;
using System.Windows.Forms;
using System.Resources;
using Microsoft.Win32;

In the above namespaces using System.Diagnostics is used for event log.

Create an Event log.
We can create the event log by using the class EventLog.
MyEventLog.WriteEntry has the following options


EventLog.WriteEntry(Registered event source,Event entry message, Event type ,Application-specific ID,Application-specific category, Event data );

The follosing code is used to create an event log

EventLog MyEventLog = new EventLog();
MyEventLog.log = "Application";
MyEventLog.Source = "";
MyEventLog.WriteEntry("The member enterd into the webpage");

We can get the Event log entries by using the following code
The following code will display 100 events in the log

for(int i = 0; i < 100; i++)

The following code is used to close the event log.




No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: