No logging of exceptions unless Instrumentation is installed?

Topics: Data Access Application Block, Exception Handling Application Block, Logging Application Block
Sep 22, 2008 at 5:08 PM

On my development machine I’ve made an asmx web service that logs exceptions to both the event log and a database using the enterprise library version 3.1. I also use the exception handling application blog to replace exceptions obtaining some sort of exception shielding. Everything works just fine on my development box.

However, when I deploy the service to another machine nothing is logged to either the event log or the database. I still get the replacement of exceptions, but no logging. Unless (and now things get spooky) I install Enterprise Library including Instrumentation on the target server.

Why is that? Is there a workaround?

I’d like to deploy the enterprise library as private assemblies only.

 

Thanks a lot,

Michael Brandt Lassen
3F, Denmark

 

 

Sep 23, 2008 at 2:35 PM
Hi,

This is what I think is happening (assuming you're using the default "Enterprise Library Logging" as the event log source and that the event log listener is configured as the first listener in your category).

Your application is not running with an admin user in your target machine. When you try to log, the event log trace listener kicks in and tries to log to some source; however, since the source doesn't exist yet it tries to create it and fails because the process doesn't have the required privileges. Because it fails, all logging to the trace source fails, and the database listener doesn't have a chance to run. As part of installing instrumentation for EntLib a source with name "Enterprise Library Logging" is created, so logging requests succeed from then on.

In a nutshell, you need to perform some tasks as admin if you want to use the event log from an app not running as an admin. You can either run installutil in the logging assembly, or follow the instructions from http://blogs.msdn.com/ploeh/archive/2007/09/20/InstallingEventSourcesForTheLoggingApplicationBlock.aspx to install a new source based on the contents from the configuration file.

Regards,
Fernando

Sep 25, 2008 at 11:32 AM

Hi Fernando

Thank you so much for your insights. You are spot on.

You solved my problem,

Michael