How to add event log category in Windows Server 2008?

Posted by Jay on Stack Overflow See other posts from Stack Overflow or by Jay
Published on 2010-03-26T04:54:23Z Indexed on 2010/03/26 5:03 UTC
Read the original article Hit count: 357

Filed under:

I have created a service plan to run on Windows server 2008. When I test the service in my Windows XP, the event log category can be created properly. However, It doesn't work on server 2008. I run the service as administrator account already.

    private EventLog __eventLog;
    if (!EventLog.SourceExists("MyEventLogCat"))
        EventLog.CreateEventSource("MyEventLogCat", "MyEventLogCat");
    __eventLog = new EventLog();
    __eventLog.Source = "MyEventLogCat";
    __eventLog.Log = "MyEventLogCat";

Thanks.

© Stack Overflow or respective owner

Related posts about c#