views:

21

answers:

1

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.

+1  A: 

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.

Dave Swersky
ok thanks, so correct me if im wrong, this event id can also be used to track application's custom error code?
C_Rance
Yes, you can build a table of error codes that you might provide to a tech support staff. The code can be used to provide additional information, at your discretion.
Dave Swersky
ok, thanks very much for your info, helped me alot.
C_Rance