C_Rance
C_Rance

Reputation: 661

WIndow Services Event ID

I'm doing a C# project window service. 1st time doing it. I have managed to installed and checked that it is working.

1 thing that puzzle me is that when I see the event log, I notice all or almost all of the other services has its own Event ID. However in my project, I can't find the place to put this event id.
Only saw a exit code, which I do not think is for this purpose.

Can someone guide me on how do I put a custom event id on my window service project as all the window service I created will have a event ID 0.

Thanks.

Upvotes: 2

Views: 4843

Answers (1)

Dave Swersky
Dave Swersky

Reputation: 34820

Event IDs are application-specific. You decide what they mean. More information:

http://support.microsoft.com/kb/307024

Example:

EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Warning,  234);

The "234" code above is arbitrary, it could be any number. You can use this to develop a list of return codes so you can trace codes back to a particular type of log entry.

Upvotes: 5

Related Questions