Dear all who might be able to help...
I'm trying to use the Enterprise Library logging and instrumentation application block (amongst others). In particular, I want to log events to a new event log. I've added the necessary configuration to my project web.config file using the Enterprise Library Configuration GUI. This (I believe) simply requires adding a new Event Log Sink, setting the name of the log you want to create (I don't want to write to the default Application log, I want a new one) and the name for the source that will then write to that log.
Then it just remains to add the new Event Log Sink as a destination for one of the categories.
Unfortunately, when I attempt to write to the log using my application using the following simple few lines of code (thanks to Enterprise Library):
LogEntry log = new LogEntry();
log.EventId = 100;
log.Message = "Logging to a brand new event log";
log.Category = "General"; //General is default so use this category for now
log.Priority = 1;
Logger.Write(log);
I am getting the 'Requested registry access is not allowed' error.
Now for (way) too long, I've been trying to fix this and have tried every suggestion i can find out there - changing permissions for the event log registry settings, running InstallUtil.exe on the dlls (both in the bin of the app and in the installation folder for Enterprise Library) and I still can't fix it.
Anyway, to cut a long story short, there's one thing which is now really bugging me:
By using the LoggingQuickStart project which ships with Enterprise Library, and changing the app.config file of the application (again, using the Enterprise Manager Config GUI) such that a brand new log will be created, everything works fine - new log in the event list, new source, everything's great. This suggests to me that all permissions/installations etc must be fine but that there's something I'm not doing in the code which I should be ...
Does anyone have any clue what that Quick Start application which comes with Enterprise Library is doing which is so special?!
Olly P