Search code examples
c#log4netevent-log

Is it possible to specify a custom text Task Category using the EventLogAppender in log4net?


If you look at the Windows Event Viewer, you'll see some tasks with Task Categories such as Gatherer and Firing Agent, but if you use log4net to log events, you can only provide a short integer value in the category property. I think it is the same case using System.Diagnostics method of logging events.

Is there some way of specifying string/text categories, or perhaps defining enums for the event viewer to use?


Solution

  • You need to register your categories. I found this article which explains how this works (though it is a bit dated, I have the impression that the information is still correct):

    http://drdobbs.com/184405714