The last few evenings I was creating a new windows application, using the Logging block. But what I did: the application wasn't logging in the eventlog.
Finally I found the problem: using Windows 7 (64bt) with UAC the application (from VS2008 while debugging) can't create the application registry-key for the event log. When I disable UAC it will create the key and everything works. When I turn UAC on again,
everything works fine, because the key already exist.
I have checked the source-code of the Logging block and there is an exception that raised, but that exception cannot handled by my own application (it is handled in the block itself).
When I want to deploy the application, the user can changed the source (that is used for the eventlog) from the app.config. But if the user haven't got the admin rights, logging doesn't work anymore.
At this moment I have changed my source code:
If (! EventLog.SourceExists("appname"))
Dim id As WindowsIdentity = WindowsIdentity.GetCurrent
Dim p As WindowsPrincipal = New WindowsPrincipal(id)
throw Exception("Can't create Eventlog and user haven't got Admin rights")
Is it possible to handle this in the next release of EntLib?? Or maybe a static method that is trying to create the eventlogs that are specified by the application??
Is there a solution for debugging this in VS2008 (with UAC enabled), when the EventLog doesn't exist??