title: Using log4net as a class library?
body: <p>I'm working with a console application with c#, visual studio 2008, .net framework 3.5, windows 7. I've created a log4net library and plan to use it on several projects on my solution.</p>
  
  <p>This is how my log4net library class looks like:</p>
  
  <pre><code>public class LibraryLogClass1
  {
      private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
  
      public static void Method3(string message)
      {
          log.Debug(message);
      }
  }
  </code></pre>
  
  <p>In my main console project I have this:</p>
  
  <pre><code>   class Program
      {
  
          static void Main(string[] args)
          {
              LibraryLog3.LibraryLogClass1.Method3("test3");
          }
      }
  </code></pre>
  
  <p>I've added this line in my AssemblyInfo.cs in my console project:</p>
  
  <pre><code>[assembly: log4net.Config.XmlConfigurator(Watch = true)]
  </code></pre>
  
  <p>This is my App.config in my console project:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/&gt;
    &lt;/configSections&gt;
    &lt;log4net&gt;
      &lt;root&gt;
        &lt;level value="DEBUG"/&gt;
        &lt;appender-ref ref="LogFileAppender" /&gt;
      &lt;/root&gt;
      &lt;appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender" &gt;
        &lt;file value="C:\test3.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;layout type="log4net.Layout.PatternLayout"&gt;
          &lt;conversionPattern value="%d [%t] %-5p %c %m%n" /&gt;
        &lt;/layout&gt;
      &lt;/appender&gt;
    &lt;/log4net&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>When I ran the program the file is not created.</p>
  
  <p>How can I solve this?</p>
  
  <p>thanks</p>