473,495 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem with Event Log event triggers

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.e ntryWrittenToLog);

......

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

Nov 17 '05 #1
2 2668
According to the Microsoft documentation on the EntryWritten event, that is
by design - a feature...

http://msdn.microsoft.com/library/de...ittentopic.asp

HTH

Dale Preston
MCAD, MCDBA, MCSE
"amol" <am*****@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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.e ntryWrittenToLog);

.....

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

Nov 17 '05 #2
Thanks Dale... I'll read the docs first next time. :)

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1732
by: Ant | last post by:
Hi, I'm, having some problems with this function. function displayElements() { for (i=0;i<document.forms.elements.length; ++i) { document.writeln(document.forms.elements.value); }
7
1586
by: mabond | last post by:
Hi Can't get my head round something which I reckon should be simple. My app has a main form (frmMain). MdiContainer set to true. A menu item triggers a new form (frmSelect) whose parent is...
10
1891
by: B. Chernick | last post by:
I am using a System.Web.UI.WebControls.Table control on a screen. (Dot Net 1.1) My problem is this: The table is programmatically reconstructed on every postback. Each table row contains two...
1
1987
by: josh | last post by:
Hi, I have several independent, system components that write audit events to a database locally via ODBC and remotely via TCP, and I have a requirement to audit when the database is available for...
1
3886
by: koraykazgan | last post by:
Hi all, I have a user control (ASCX). In that user control there is a panel, and inside that panel there is a textbox and a button. The panel has a DefaultButton property set, which is set to the...
0
7120
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6991
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7160
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7196
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6878
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7373
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4897
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4583
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.