In this post we will explore the following topics:
1. How to view Event Logs?To View Click Here (http://mctsexam70-536tutorials.blogspot.com/2010/09/how-to-view-event-logs.html)
2. How to Register an Event Source?To View Click Here (http://mctsexam70-536tutorials.blogspot.com/2010/09/how-to-register-event-source.html)
3. How to Log Events? To View Click Here (http://mctsexam70-536tutorials.blogspot.com/2010/09/how-to-log-events.html)
4. How to Read Events?(http://mctsexam70-536tutorials.blogspot.com/2010/09/how-to-read-events.html)
The following is the sample code for the above topics:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
if (!EventLog.Exists("My Log"))
{
EventLog.CreateEventSource("Sam Application", "My Log");
}
EventLog mylog = new EventLog("My Log");
mylog.Source = "Sam Application";
mylog.WriteEntry("Could not connect", EventLogEntryType.Error, 1001, 1);
Console.WriteLine("Event log written now trying to read from event log");
Console.ReadKey();
Console.Clear();
foreach (EventLogEntry entry in mylog.Entries)
Console.WriteLine(entry.Message);
Console.WriteLine("Press any key to exit!!!");
Console.ReadKey();
}
}
}
We will see in detail all the three topics in the coming video tutorials which will be posted soon.
Regards
Sameer Shaik
Tags: Microsoft MCTS exam, Learn, Tutorials, Free C#, Free Videos, Microsoft Dot Net Jobs,Microsoft Dot Net Jobs Interview, Free Training and Preparation, Jobs MCTS specialization, visual studio.net, study guide, sample questions, Exam Prep, Exam Practice Test
No comments:
Post a Comment