I recently had a problem writing to the event log from my application. I had configured the application to use the Logging Application Block from the 3.1 version of the Microsoft Enterprise Library and followed the walk-through in the documentation to log exceptions to the Application Log, but nothing was appearing.
I had amended the code so that it always through an exception on clicking a test button, and stepping through the code, I could see that Log.Write was being called and no error was raised from this call.
A quick search on Google suggested that this was a permissions issue for the ASP.Net account, so I added the following key:
HKLM\System\CurrentControlSet\Services\EventLog\Application\<my app name>
I granted full control to the ASPNET account to this key and amended the source property of my trace listener to <my app name> using the Enterprise Library Configuration Manager.
I now get events recorded in the Application log and their source is set to <my app name> so it is easy to filter them for the events I want.
1 comment:
You better use this .NET code snippet
EventLog.CreateEventSource("SCDService", "");
as without you get ugly headers in your eventlog entry like Error ID (100) not found in DLL....
Post a Comment