Log into event viewer using c#

This code will write directly to the event log Application:

//Reference
using System.Diagnostics;


//Program
using (EventLog eventLog = new EventLog("Application"))
{
   eventLog.Source = "Application";
   eventLog.WriteEntry("Your Message", EventLogEntryType.Information, 101, 1);
}


Figure below depicts the event viewer log:

Comments

Popular posts from this blog

SQL Interview Questions and Answers

Generic Interface and Factory Pattern in C#

How to get device info IMEI programmatically in xamarin android