Cannot change source to trace listeners

Sep 8, 2008 at 2:51 PM
I tried to change source to trace listeners "Formatted EventLog TraceListener" from the default "Enterprise Library Logging" to my own source name "My application logging". After changing it I got error in Event Viewer. What's wrong?


Sep 9, 2008 at 2:51 PM
Hi,

If your application runs with the identity of a standard user and the new source does not exist, then the EventLog API will try to create it and fail because only admins can create new sources for logs. The creation will succeed if you run your app as an admin.

Here's a post about a way to automate the creation of event log sources http://blogs.msdn.com/ploeh/archive/2007/09/20/InstallingEventSourcesForTheLoggingApplicationBlock.aspx.

Hope this helps,
Fernando