As we know, we can use the class EventLog to write event logs, but I am confused about how to write category name in my event log. Thoug it provides the category parameter, for example, one of the type of WriteEntry is:
public void WriteEntry(
string message,
EventLogEntryType type,
int eventID,
short category
)
And it just shows number in my log. Why the type of category is short, not string? How to display the category name in the Event Viewer? Thanks! By the way, we will not create the custom CategoryMessageFile.
You can write an event log entry with a given category but you need to create an extra native dll with a String Resource table which is registered in the event log. This does complicate your deployment further. You currently have to do during installation
Now you can use the overload to write an event log message with a given category.
There is a very good Dr. Jobs Journal article describing exactly your problem.