title: configuration of log4net
body: <p>I want to use log4net in my application in C#. </p>
  
  <p>I made configuration file for log4net: <code>ConsoleTest.exe.log4net</code> and set in the properties option to copy to the destination folder:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;configuration&gt;
  &lt;configSections&gt;
      &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/&gt;
  &lt;/configSections&gt;
  &lt;log4net&gt;
      &lt;appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender"&gt;
          &lt;layout type="log4net.Layout.PatternLayout"&gt;
              &lt;conversionPattern value="%date{ABSOLUTE} [%thread] %level %logger - %message%newlineExtra Info: %property{testProperty}%newline%exception" /&gt;
          &lt;/layout&gt;
          &lt;filter type="log4net.Filter.LevelRangeFilter"&gt;
              &lt;levelMin value="INFO" /&gt;
              &lt;levelMax value="FATAL" /&gt;
          &lt;/filter&gt;
      &lt;/appender&gt;
      &lt;appender name="TraceAppender" type="log4net.Appender.TraceAppender"&gt;
          &lt;layout type="log4net.Layout.PatternLayout"&gt;
              &lt;conversionPattern value="%d [%t] %-5p %c %m%n"/&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
  &lt;appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"&gt;
    &lt;file value="mylogfile.txt"/&gt;
    &lt;appendToFile value="true"/&gt;
    &lt;rollingStyle value="Size"/&gt;
    &lt;maxSizeRollBackups value="5"/&gt;
    &lt;maximumFileSize value="10MB"/&gt;
    &lt;staticLogFileName value="true"/&gt;
    &lt;filter type="log4net.Filter.StringMatchFilter"&gt;
      &lt;stringToMatch value="test"/&gt;
    &lt;/filter&gt;
    &lt;filter type="log4net.Filter.StringMatchFilter"&gt;
      &lt;stringToMatch value="error"/&gt;
    &lt;/filter&gt;
    &lt;filter type="log4net.Filter.DenyAllFilter"/&gt;
    &lt;layout type="log4net.Layout.PatternLayout"&gt;
      &lt;conversionPattern value="%date [%thread] %level %logger - %message%newline%exception"/&gt;
    &lt;/layout&gt;
  &lt;/appender&gt;
      &lt;root&gt;
          &lt;level value="INFO"/&gt;
          &lt;appender-ref ref="RollingFileAppender"/&gt;
      &lt;/root&gt;
      &lt;logger name="Log4NetTest.OtherClass"&gt;
          &lt;level value="DEBUG"/&gt;
          &lt;appender-ref ref="RollingFileAppender"/&gt;
      &lt;/logger&gt;
  &lt;/log4net&gt;
  </code></pre>
  
  <p></p>
  
  <p>In the project in Visual Studio 2012, in properties, in file <code>AssemblyInfo.cs</code> I added:</p>
  
  <pre><code>[assembly: log4net.Config.XmlConfigurator(
  ConfigFile = "ConsoleTest.exe.log4net", Watch = true)]
  </code></pre>
  
  <p>In the class where I want to log I added:</p>
  
  <pre><code>private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
  </code></pre>
  
  <p>but when I write in this class:</p>
  
  <pre><code>log.Debug("This is a DEBUG level message. The most VERBOSE level.");
  log.Info("Extended information, with higher importance than the Debug call");
  log.Warn("An unexpected but recoverable situation occurred");
  </code></pre>
  
  <p>I don't get anything at output :( </p>
  
  <p>Where is a problem ? </p>
  
  <p><strong>Edit:</strong>
  Is my configuration file correct?</p>