I’m studying Ms Enterprise Library 5.0 and have a problem with Application Logging Block: example app “Logging” (http://entlib.codeplex.com/releases/view/46741#DownloadId=140302) doesn’t write to Windows Event Log (Logging category – “General”, main menu function “SimpleLogWriterWrite”. One time it created new Windows Event Log with given name, but another time – didn’t (with another name). One time it has written messages into exisitng log, another time – hasn’t. What’s the problem?
Thanks.
Both the event log and source names must be registered with Windows before you can write events. Writing events can be done by any user account, but creating event log and source names requires admin rights.
The best way to set up event logging in a production app is to create the event log and source names during installation, when you can legitimately demand admin rights. The simplest way of doing this is:
Installer Classcomponent to your application project.EventLogInstallercomponent to the design surface of the installer component. This is not available in the toolbox by default, but you can easily add it from the toolbox right-click menu.EventLogInstallercomponent to create your desired event log and source names.