A
amol
Hi,
I have the following code to raise events when something gets written
to the Application log. The problem I'm seeing is when a bunch of
entries get written to the log at the same time (or within a couple of
seconds of each other). I receive an event for the first entry, but
the events for the other entries aren't triggered until another entry
is written to the log.
System.Diagnostics.EventLog eventLogToMonitor = new
System.Diagnostics.EventLog();
eventLogsToMonitor.Log = "Application";
eventLogsToMonitor.EnableRaisingEvents = true;
eventLogsToMonitor.EntryWritten += new
System.Diagnostics.EntryWrittenEventHandler(this.entryWrittenToLog);
......
private void entryWrittenToLog(object sender,
System.Diagnostics.EntryWrittenEventArgs e)
{
Console.WriteLine(DateTime.Now + ": " + e.Entry.Source);
}
For example,
2:00:00 pm - Error 1 written to log
2:00:00 pm - Error 2 written to log
2:00:01 pm - Error 3 written to log
2:05:00 pm - Information 1 written to log
I see on the console:
2:00:00: Error 1 source
2:05:00: Error 2 source
2:05:00: Error 3 source
2:05:00: Information 1 source
Basically, an event is raised in my code when Error 1 gets written. NO
events are raised for Error 2 or 3. Then 5 minutes later when
Information 1 gets written, I see events being raised for Error 2, 3
and Information 1 all together.
Any ideas on what the problem might be?
Thanks,
Amol
I have the following code to raise events when something gets written
to the Application log. The problem I'm seeing is when a bunch of
entries get written to the log at the same time (or within a couple of
seconds of each other). I receive an event for the first entry, but
the events for the other entries aren't triggered until another entry
is written to the log.
System.Diagnostics.EventLog eventLogToMonitor = new
System.Diagnostics.EventLog();
eventLogsToMonitor.Log = "Application";
eventLogsToMonitor.EnableRaisingEvents = true;
eventLogsToMonitor.EntryWritten += new
System.Diagnostics.EntryWrittenEventHandler(this.entryWrittenToLog);
......
private void entryWrittenToLog(object sender,
System.Diagnostics.EntryWrittenEventArgs e)
{
Console.WriteLine(DateTime.Now + ": " + e.Entry.Source);
}
For example,
2:00:00 pm - Error 1 written to log
2:00:00 pm - Error 2 written to log
2:00:01 pm - Error 3 written to log
2:05:00 pm - Information 1 written to log
I see on the console:
2:00:00: Error 1 source
2:05:00: Error 2 source
2:05:00: Error 3 source
2:05:00: Information 1 source
Basically, an event is raised in my code when Error 1 gets written. NO
events are raised for Error 2 or 3. Then 5 minutes later when
Information 1 gets written, I see events being raised for Error 2, 3
and Information 1 all together.
Any ideas on what the problem might be?
Thanks,
Amol