Log4Net runs on a Dev machine, does not work when deployed to a shared host (using the same db / connstring)

I have log4net configured and working fine on my local machine, however, when I deploy my host (godaddy), it fails. I use the same database / config file on my dev machine and on the host. My link to log4net is configured to copy locally, and log4net.dll, .pdb and .xml exist in the trash on the host. This is an asp.net mvc application.

Edit: No exceptions are thrown, and the application works as expected (minus logging)

It Works on SQL Server 2005 Web Hosting - IIS 7

The main details of my configuration:

<root> <level value="DEBUG" /> <appender-ref ref="AdoNetAppender" /> </root> <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender"> <bufferSize value="1" /> <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 

Does anyone have any validation ideas?

+4
source share
2 answers

In my experience, log4net usually swallows any internal errors, simply leading to log statements that produce no results.

What you can try is enable log4net for internal logging. You can do this by adding the following to the appSettings section:

 <add key="log4net.Internal.Debug" value="true" /> 

This sets the LogLog.InternalDebugging property to true . log4net will now log onto standard output and error streams and configured trace listeners.

You can use the following configuration to capture any messages registered for tracking:

 <system.diagnostics> <trace autoflush="false" indentsize="4"> <listeners> <add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\TextWriterOutput.log" /> <remove name="Default" /> </listeners> </trace> </system.diagnostics> 

All messages logged by log4net internally will be displayed in TextWriterOutput.log . If you get a SecurityException when you add a trace listener to your configuration, then most likely the application identifier does not have sufficient rights to create the file in the specified location (in the example: c:\ ). Try a different place or give sufficient application identifier rights.

+7
source

I just was able to solve this problem by downloading and using the latest build of log4net (version 1072765) from the SVN repository http://svn.apache.org/viewvc/logging/log4net/trunk/

Apparently, this problem has been fixed long ago, but who knows when log4net 1.2.11 will be released.

+1
source

All Articles