Create a new event soure in Windows Server 2008

windows-event-logwindows-server-2008

I have added logging to a web application (using the Enterprise Library framework) so exceptions are recorded in the application event log. I have given the event has a source called "WebApp" but this isn't being recorded as the source doesn't exist.

Is there a way to manually add a new event source? I have found some examples on stackoverflow but these require creating custom install applications so before I go down this road I'm wondering if there is a simpler method.

Best Answer

You need to add the source in the code of your web application, using:

System.Diagnostics.EventLog.CreateEventSource("MyApp1", "Application");

Source