logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lenka Rolinek" <Lenka.Roli...@ir.com>
Subject RE: log4net usage in IIS7.5 ASP.NET MVC (multi assembly) application
Date Wed, 09 May 2012 12:03:27 GMT


I am hoping someone can help...


We have a multi assembly ASP.NET MVC 3 application that runs on IIS7.5.

We are using log4net version 1.2.10.

We call log4net LogManager.GetLogger("loggerName").Error("..."); from
all assemblies of our web application.


Logging from all assemblies works when we run our web application on our
development systems from MS Studio 2010.

I.e. the log contains logged information from all our application


Logging from assemblies but the main one (the one from which log4net was
registered, i.e. includes global.asax.cs file) does _NOT_ work when we
run our web application installed on IIS7.5.

I.e. the log contains logged information from the application assembly



Following is a list of all log4net 'configuration parts' in our


1.       Log4net configuration is stored in a config file dedicated for

The content of this file is below.


<?xml version="1.0" encoding="utf-8" ?>




        <!-- To support configuration file change detection. -->

        <section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />



    <!-- To turn the logging off completely, set threshold to OFF as
shown below. -->

    <!-- log4net threshold="OFF" -->


        <!-- Set root logger level to ERROR or above and its appender to
RollingFile. -->

        <!-- Note, loggers that are not listed here will use root logger
settings. -->

        <!-- Logger levels are -




            <level value="ALL" />

            <appender-ref ref="RollingFile" />


        <appender name="RollingFile"

            <file value="logFile.txt" />

            <appendToFile value="true" />

            <staticLogFileName value="true" />

            <rollingStyle value="Size" />

            <maximumFileSize value="10MB" />

            <maxSizeRollBackups value="5" />

            <layout type="log4net.Layout.PatternLayout">

                <conversionPattern value="%date{yyyy-MM-dd HH:mm:ss}
%5level %logger: %message%newline" />


                     <!-- example of exclude filter

            <filter type="log4net.Filter.LoggerMatchFilter">

                <loggerToMatch value="TextToMatch" />

                <acceptOnMatch value="false" />









2.       We inititialise the logging in global.asax.cs file using the
following API and we are positive the location of the configuration file
is correct.


      protected void Application_Start()




            // Configure log4net

            string webConfigPath =
HttpContext.Current.Server.MapPath("~") + @"Web.log4net.config";



3.       We also give the web application pool privileges to
create/write log file in the folder that is meant to contain log files.


4.       We also enabled getting HttpContext as suggested on this
discussion -

   [AspNetCompatibilityRequirements(RequirementsMode =

   [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]

   public class DataView






Is there anything else we must do?

Is it expected to work with log4net version 1.2.10?

Any suggestions?







This email is intended only for the use of the individual or entity named above and may contain
information that is confidential and/or privileged. If you are not the intended recipient,
you are hereby notified that any dissemination, distribution or copying of this Email is strictly
prohibited. If you have received this Email in error, please notify us immediately by return
email or telephone +61 2 9966 1066 and destroy the original message. Thank You
View raw message