Writing to windows event log

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
As you may have noticed, I am normally a java programmer but today I am researching something a little different. Our app needs to send errors of the the windows event log. The worst of it is taken care of already: we have various native (c++, .NET...) solutions that will write to the log and the jni shell to access them from our app. The problem we are having is with specifying an eventId and a category; it seems we have to precompile a dll with possible values hardcoded. This would make our development process fairly tedious as event ids are added and changed constantly (but they are final after building).

What I'd like to know is: is there a way that these parameters (event id, category) can be specified on the fly without the need for the logging service to have prior knowledge of their values? Proving that this cannot be done would also be very helpful.

I'm also open to any and all comments you have on the general subject of windows logging as I am completely new to the subject. Also appreciated would be links to tutorials/specifications on logging, so long as they discuss this pre-specification of ids.

Thanks.
 

torpid

Lifer
Sep 14, 2003
11,631
11
76
Hm. I log with no category and an event id of 0. I'm using the microsoft exception management application block for .net. I don't know what your exact needs are, but it simplifies a lot of work. Of particular use may be the DefaultPublisher class in the ExceptionManager.cs
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
What shows up in the log under the category when you don't use it? We're currently getting some number in brackets when we want to put a specific word in but I don't know the mechanism we're using atm. I should look into that a bit more too.

As for the libraries/classes you speak of, is there nice online api documentation? I don't currently have any windows sdks or dev environments on my machine so my research is entirely google based...
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Let me rephrase this: when you write to the windows log what event IDs do you use and do you specify them yourselves in a message dll?
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
From that link:
You can also specify application-defined eventId
That's the problem, I've got tonnes of ways to write to the log but precious few explanations about the mysterious ids. We've caved though, and we're going to automate the construction of this dll as part of our build process. Thanks for the link though.