Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What event id to use for my custom event log entries?

Is there any ranges of valid event IDs which should be used by custom applications while logging to Windows EventLog? Or I can use any event ID of my choice (1,2,3,4....). P.S, I am developing in C#.NET.

like image 873
Niran Avatar asked Nov 18 '09 12:11

Niran


People also ask

What is event ID in Event Viewer?

Event identifiers uniquely identify a particular event. Each event source can define its own numbered events and the description strings to which they are mapped in its message file. Event viewers can present these strings to the user.

What are the 3 types of logs available through the Event Viewer?

Types of Event Logs They are Information, Warning, Error, Success Audit (Security Log) and Failure Audit (Security Log).


2 Answers

EventIds are application specific so you can use whatever ranges you like. Just ensure you document what you have used and where so that you can ensure you don't use an id twice, or to facilitate easier debugging.

But keep in mind...

Like when Henry Ford said "you can have any color you want as long as it's black" - you can also use whatever range you like as long as that range falls inside the range of 0 and 65535.

like image 176
Martin Avatar answered Sep 16 '22 14:09

Martin


Sure enough, it is up to the author to define and track event IDs they use and what they mean.

Here is a reference: http://msdn.microsoft.com/en-us/library/e29k5ebc.aspx - Particularly interesting is the part about not writing messages with IPv6 addresses (because of the % character) to the event log. I bet you can use a parameter to work around that though.

like image 41
colbybhearn Avatar answered Sep 18 '22 14:09

colbybhearn