Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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");


share|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

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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