logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cijojohn <cijoj...@gmail.com>
Subject Logging not happening when run on IIS using log4net
Date Thu, 24 Sep 2009 18:18:58 GMT

I’m using an ASP.net web application, in that I’m using log4net for logging.
When I run the project, in the ASP.net development server, I’m able to log
the logger statements.
But when the application is run on IIS no logging happens. My application is
set as a virtual directory inside a Asp web application.

Below is my setting in webconfig.
<configuration>
      <configSections>
            <section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net>
    <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
                  <!-- Please make shure the ..\\Logs directory exists! -->
                  
                  <!---->
                  <layout type="log4net.Layout.PatternLayout">
                        
                  </layout>
            </appender>
            <appender name="SmtpAppender"
type="log4net.Appender.SmtpAppender">
                  <to value=""/>
                  <from value=""/>
                  <subject value=""/>
                  <smtpHost value=""/>
                  <bufferSize value="512"/>
                  <lossy value="true"/>
                  <evaluator type="log4net.Core.LevelEvaluator">
                        <threshold value="WARN"/>
                  </evaluator>
                  <layout type="log4net.Layout.PatternLayout">
                        <conversionPattern value="%newline%date [%thread]
%-5level %logger [%property] - %message%newline%newline%newline"/>
                  </layout>
            </appender>
            <logger name="File">
                  <level value="All"/>
                  <appender-ref ref="LogFileAppender"/>
            </logger>
            <logger name="EmailLog">
                  <level value="All"/>
                  <appender-ref ref="SmtpAppender"/>
            </logger>
      </log4net>
</configuration>
In my appication start I’m using the following code

protected void Application_Start(object sender, EventArgs e)
        {
            log4net.Config.XmlConfigurator.Configure();
        }
My C# class is as follows.

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.IO;
using log4net;
namespace SEAIWedgeSizing.Pages
{
    public partial class SizingMaster : System.Web.UI.Page

    {
        private ILog logger = LogManager.GetLogger("File");
        protected void Page_Load(object sender, EventArgs e)
        {
            logger.Debug("**** Entering  Class - SizingMaster :: Method -
Page_Load ********");
        }
}
}

Are there any seetings in IIS?
-- 
View this message in context: http://www.nabble.com/Logging-not-happening-when-run-on-IIS-using-log4net-tp25578031p25578031.html
Sent from the Log4net - Dev mailing list archive at Nabble.com.


Mime
View raw message