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.

link|improve this question

feedback

2 Answers

up vote 1 down vote accepted

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

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

Source

link|improve this answer
Thanks. I take it there isn't a way to do this from the server console? – Keith Bloom Aug 6 '09 at 10:35
Not that I know of i'm afriad – Sam Aug 6 '09 at 10:44
In that case I don't think there is. In to the code it goes. – Keith Bloom Aug 6 '09 at 10:46
feedback

If you use PowerShell you can create the event source from the console like this:

[System.Diagnostics.EventLog]::CreateEventSource("MyApp1", "Application")

If you don't have it installed as a feature in WS 2008, you should.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.