logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geert Verbakel <geert.verba...@gmail.com>
Subject Re: ASP.NET starter help.
Date Tue, 31 Jan 2006 11:33:27 GMT
Hi Devin,

I am having the same problem for logging in Application_Start and
Session_Start.
However all other logging is working fine (in the pages + also in
global.asax, but only in Session_End and Application_End)

Regards,
Geert


On 1/31/06, Devin Smith <devinsmith@gmail.com> wrote:
>
> Hi,
>
> I've spent a number of hours trying to get log4net to log something in
> an ASP.NET project but have not gotten anywhere. Hopefully someone can
> tell me what's going on here.
>
> In the AssemblyInfo.cs file for my main site I have:
>
> [assembly: log4net.Config.Repository("SiteCore")]
> [assembly: log4net.Config.XmlConfigurator(ConfigFileExtension="log4net",
> Watch=true)]
>
> In Global.ascx.cs:
>
> // Class fields
> private static readonly ILog log =
> log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod
> ().DeclaringType);
>
> and inside Application_Start:
>
> public void Application_Start(object sender, EventArgs e)
> {
>                log4net.Config.XmlConfigurator.Configure();
>                log.Info("Hello World, I am a logger");
> }
>
> Now because I have the settings above in my AssemblyInfo.cs I need a
> seperate config file (well according to the mailing list, and many
> blog sites). Inside the bin of my ASP.net project I have a
> SiteCore.dll.log4net file that contains the following:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <!-- This section contains the log4net configuration settings -->
> <log4net>
>        <!-- Define some output appenders -->
>        <appender name="RollingLogFileAppender"
>                  type="log4net.Appender.RollingFileAppender,log4net">
>           <param name="File"
>              value="C:\\Inetpub\\wwwroot\\test1\\LogFiles\\mylog.txt"/>
>           <param name="AppendToFile" value="true"/>
>
>        <param name="MaxSizeRollBackups" value="10"/>
>        <param name="MaximumFileSize" value="5MB"/>
>        <param name="RollingStyle" value="Size"/>
>        <param name="StaticLogFileName" value="true"/>
>        <layout type="log4net.Layout.PatternLayout,log4net">
>                <param name="ConversionPattern"
>                value="%d [%t] %-5p %c [%x] - %m%n"/>
>        </layout>
>        </appender>
>
>        <!-- Setup the root category, add the appenders and set the default
> priority -->
>        <root>
>                <level value="DEBUG" />
>                <appender-ref ref="RollingLogFileAppender" />
>        </root>
> </log4net>
>
> Now, I checked that LogFiles is writeable by ASPNET and I also created
> a 0 byte mylog.txt and made it writeable by ASPNET as well.
>
> I'm not sure what i'm doing wrong but any help is appreciated.
>
> Thanks,
>
> Devin
>

Mime
View raw message