I am reading Windows Logs in C# through below code,
string log = "Application";
EventLog demoLog = new EventLog(log);
EventLogEntryCollection entries = demoLog.Entries;
foreach (EventLogEntry entry in entries)
{
Console.WriteLine("Level: {0}", entry.EntryType);
Console.WriteLine("Event id: {0}", entry.InstanceId);
Console.WriteLine("Message: {0}", entry.Message);
Console.WriteLine("Source: {0}", entry.Source);
Console.WriteLine("Date: {0}", entry.TimeGenerated);
Console.WriteLine("--------------------------------");
}
Now, is there any way that whenever an event came up, the console give that output?
Here Console application should treat as "Subscription" application, which should give immediately the event output as soon as event generates.
Thanks!