Logging Application Block How to log in different event log other than application

Topics: Exception Handling Application Block, Logging Application Block
Jul 31, 2008 at 9:54 AM
How to log in different event log other than application using Enterprise Library 3.0
Jul 31, 2008 at 3:10 PM
Hi,

You can specify the "Log" property in the event log trace listener's configuration. Keep in mind that once an event log source is registered to a log, either explicitly or when you attempt to log for the first time from a process with the appropriate permissions, you cannot specify a different log for that source.

Fernando
Aug 1, 2008 at 5:53 AM
Hi Fernando,

Thanks,

My problem is, i am able to log in "Application" event log but when i change the property log="TestLog" which is event log created by me i am not able to log the messages in the new event.

Please let me know how this works.


hoping in answer
Vinay

Aug 1, 2008 at 5:43 PM
Vinay,

Just changing the log will not work. Once you've logged with a given log/source combination, the source gets bound to the log and trying to log to a different log with the same source will fail; you need to remove the source or change both the log and the source.

If you're running on Vista or Server 2008 with UAC activated, and you haven't explicitly installed the event log source (eg as described in http://blogs.msdn.com/ploeh/archive/2007/09/20/InstallingEventSourcesForTheLoggingApplicationBlock.aspx), the first time you attempt to log the process needs to run as an administrator so it can register the log and the source in the system.

Regards,
Fernando