Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've written a simple batch script that watches some services and regularly restarts them. I've used the eventcreate command to write to the Windows event log, which seems like a good way of logging my actions, but I notice that the 'category' field is always empty. Can I use this field to put some extra information in? There doesn't seem to be a parameter on eventcreate for it. Or is this reserved for some internal Windows data?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The event category isn't a free-form text field-- it's a numeric index (a WORD value, actually) into a table of values that are specified in an event message file (see http://msdn.microsoft.com/en-us/library/aa363649(VS.85).aspx for technical detail).

Basically, EVENTCREATE doesn't expose the Category value to you, so you can't set it. If you wanted to code something up that called the event logging APIs directly (http://msdn.microsoft.com/en-us/library/aa363654(VS.85).aspx) and you created an event message file you could certainly use Category. For something lightweight, though, you're probably just better off making up event IDs for your application that can be used for filtering and forget about Category.

share|improve this answer
    
A very good answer. Thank you. –  Colin Pickard Jul 29 '09 at 11:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.