Note that there are some explanatory texts on larger screens.

plurals
  1. POEnabling log levels in log4net
    text
    copied!<p>I'm writing a simple test project to experiment with log4net and I've hit a wall right off the bat. No matter what I do in my config file, the my logger is initialized with all "IsXXXXEnabled" flags set to false. Here is my very simple app.config:</p> <pre><code> &lt;log4netgroup&gt; &lt;log4net xsi:noNamespaceSchemaLocation="http://csharptest.net/downloads/schema/log4net.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;appender name="EventLogAppender" type="log4net.Appender.EventLogAppender"&gt; &lt;param name="LogName" value="Application" /&gt; &lt;param name="ApplicationName" value="HelloProgram" /&gt; &lt;threshold value="DEBUG"/&gt; &lt;layout type="log4net.Layout.PatternLayout"&gt; &lt;conversionPattern value="%logger - %newline%message" /&gt; &lt;/layout&gt; &lt;/appender&gt; &lt;root&gt; &lt;level value="DEBUG" /&gt; &lt;appender-ref ref="EventLogAppender" /&gt; &lt;/root&gt; &lt;logger name="HelloLogger"&gt; &lt;level value="DEBUG" /&gt; &lt;appender-ref ref="EventLogAppender" /&gt; &lt;/logger&gt; &lt;/log4net&gt; &lt;/log4netgroup&gt; </code></pre> <p>Here is the trivial test in Main:</p> <pre><code> ILog Log = LogManager.GetLogger("HelloLogger"); if(Log.IsErrorEnabled) Console.WriteLine("The logger is working!"); else Console.WriteLine("Nope"); </code></pre> <p>The output is "Nope". I tried switching the threshold and level values to "ALL", but nothing changed. This seems so simple, what am I missing to enable everything? Thanks</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