log4net not logging with a mixture of .net 1.1 and .net 3.5

Posted by Jim P on Stack Overflow See other posts from Stack Overflow or by Jim P
Published on 2010-03-17T17:06:55Z Indexed on 2010/06/03 4:44 UTC
Read the original article Hit count: 544

Filed under:
|
|
|
|

Hi All,

I have an iis server on a windows 2003 production machine that will not log using log4net in the .net3.5 web application. Log4net works fine in the 1.1 apps using log4net version 1.2.9.0 and but not the 3.5 web app. The logging works fine in a development and staging environment but not in production. It does not error and I receive no events logged in the event viewer and don't know where to look next. I have tried both versions of log4net (1.2.9.0 and 1.2.10.0) and both work in development and staging but not in production.

For testing purposes I have created just a single page application that just echos back the time when the page is hit and also is supposed to log to my logfile using log4net.

Here is my web.config file:

    <configSections>
    <!-- LOG4NET Configuration -->
    <section name="log4net"  type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" requirePermission="false" />
</configSections>

<log4net debug="true">
    <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
        <param name="File" value="D:\DIF\Logs\TestApp\TestApp_"/>
        <param name="AppendToFile" value="true"/>
        <param name="RollingStyle" value="Date"/>
        <param name="DatePattern" value="yyyyMMdd\.\l\o\g"/>
        <param name="StaticLogFileName" value="false"/>
        <layout type="log4net.Layout.PatternLayout">
            <param name="ConversionPattern" value="%date{HH:mm:ss} %C::%M [%-5level] - %message%newline"/>
        </layout>
    </appender>
    <root>
        <level value="ALL"/>
        <appender-ref ref="RollingFileAppender"/>
    </root>
</log4net>

Here is my log4net initialization:

        // Logging for the application
    private static ILog mlog = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

    protected void Application_Start(object sender, EventArgs e)
    {
        try
        {
            // Start the configuration of the Logging
            XmlConfigurator.Configure();

            mlog.Info("Started logging for the TestApp Application.");
        }
        catch (Exception ex)
        {
            throw;
        }
    }

Any help would be greatly appreciated.

Thanks,

Jim

© Stack Overflow or respective owner

Related posts about .NET

Related posts about .net-3.5