Logging works on XP but not on a a 2003 box

Topics: Exception Handling Application Block, Logging Application Block
Apr 19, 2007 at 11:44 PM

We have a Web application which uses Enterprise library Validation and logging blocks. Everything works fine on my dev machine which runs on XP. When I deploy our App to a windows 2003 box under IIS, logging doesn't work. I have entlib listeners configured to write to the event log and to a text file, however nothing appears in either.

If I setup a Trace listener(configured in the web.config) rather than the listeners configurable through EntLib, the application logs exception information to the file specfied by the trace listener.

It seems that a normal Trace listener will work fine but listeners configurable through EntLib will not work on a 2003 box.

If any body has any suggestions as to why I'm getting this unusual behavior on our 2003 box, I would be grateful if you could help.


Apr 20, 2007 at 10:10 AM
This could be because the eventlog Source does not exist on the 2003 box.
I normally create one during setup.


string sourcename; //probably: = "Enterprise Library Logging"

if (!EventLog.SourceExists(sourcename))
EventLog.CreateEventSource(sourcename, "Application");
Apr 20, 2007 at 11:12 AM

kepar wrote:
sorry, posted twice

Hi Kipar,

I don't think this is the problem. On XP, events are been posted to the Application category in the Event log and also hitting a text file. So effectively, I have two listeners configured through the EntLib configuration tool. Both work on XP but none work on 2003. I can setup a System.Dianostic type trace listener to log to the text file and that works fine on both environments.

Thanks for your help,

Apr 30, 2007 at 8:01 PM
I have a similar problem. Everything works fine in my PC but fails when I move to production enviromnent.
I can see that you had no response. Could you finally solve it ?
May 2, 2007 at 1:08 PM
Same problem

On my local Development Machine (WinXP) and Development Server or IIS everything works. But as soon as I move to Win 2003 no log file is created anymore.

File and directory rights are correctly set.
May 2, 2007 at 3:29 PM
I found out this. If you have 2 listeners, the first that writes the Event Log and the other that writes the file and you are running the application with a non admin user, even when you have file and directory rights correctly set, if the datasource that you are using in the event log does not exist, nothing happens. I think that this happens because the Logging Block fails in using the first listener and then does not run the other.
I hope this helps.
May 2, 2007 at 10:53 PM
Interesting point. And sounds plausible.

In my application I haven't used any Event Log Listeners explicitely. But my IIS on Win 2003 is running as a lower privileged user.
Is it possible, that there is a default Event Log listener?

I have to check that ...