Note that there are some explanatory texts on larger screens.

plurals
  1. POlog4net with ASP.NET 3.5 problems
    text
    copied!<p>I'm having some trouble getting log4net to work from ASP.NET 3.5. This is the first time I've tried to use log4net, I feel like I'm missing a piece of the puzzle.</p> <p>My project references the log4net assembly, and as far as I can tell, it is being deployed successfully on my server.</p> <p>My web.config contains the following:</p> <pre><code> &lt;configSections&gt; &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler , log4net" requirePermission="false"/&gt; &lt;/configSections&gt; &lt;log4net&gt; &lt;appender name="InfoAppender" type="log4net.Appender.FileAppender"&gt; &lt;file value="..\..\logs\\InfoLog.html" /&gt; &lt;appendToFile value="true" /&gt; &lt;layout type="log4net.Layout.PatternLayout"&gt; &lt;conversionPattern value="%d [%t] %-5p %c [%x] - %m%n" /&gt; &lt;/layout&gt; &lt;/appender&gt; &lt;logger name="_Default"&gt; &lt;level value="INFO" /&gt; &lt;appender-ref ref="InfoAppender" /&gt; &lt;/logger&gt; &lt;/log4net&gt; </code></pre> <p>I'm using the following code to test the logger:</p> <pre><code>using log4net; using log4net.Config; public partial class _Default : System.Web.UI.Page { private static readonly ILog log = LogManager.GetLogger("_Default"); protected void Page_Load(object sender, EventArgs e) { log.Info("Hello logging world!"); } } </code></pre> <p>In my Global.asax, I'm doing the following:</p> <pre><code>void Application_Start(object sender, EventArgs e) { log4net.Config.XmlConfigurator.Configure(); } </code></pre> <p>At this point, I can't think of what else I might be doing wrong. The directory I'm trying to store the log in is writable, and even if I try different directories I get the same result: no file, no logs.</p> <p>Any suggestions? :-)</p> <hr> <p>Edit: I've tried several different formats for the path &amp; name of the log file, some of which include "..\..\InfoLog.html", "InfoLog.html", "logs\InfoLog.html", etc, just in case someone is wondering if that's the problem.</p> <hr> <p>Edit: I've added the root logger node back into the log4net section, I ommitted that on accident when copying from the samples. The root logger node looks like this:</p> <pre><code>&lt;root&gt; &lt;level value="INFO" /&gt; &lt;appender-ref ref="InfoAppender" /&gt; &lt;/root&gt; </code></pre> <p>Even with it, however, I'm still having no luck.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload