title: How to setup log4net so that it works on a wcf service?
body: <p>I'm working with a solution on visual studio 2008, .net framework 3.5, windows 7. I've created a log4net library that writes to a txt file and want to use it on several projects on my solution and also on a wcf service that's in the same solution which is running locally from visual studio.</p>
  
  <p>I start the program from a console application on the solution. And the console app calls the other projects and those projects use the log4net. At this level in the workflow the log is writing fine. The problem comes when the wcf service is called. The wcf service uses the log, but log4net doesn't write to the file.</p>
  
  <p><strong>On the console project I have this:</strong></p>
  
  <p>On the AssemblyInfo.cs:</p>
  
  <pre><code>[assembly: log4net.Config.XmlConfigurator(Watch = true)]
  </code></pre>
  
  <p>On the App.config I have the log4net configuration.</p>
  
  <p>On Program.cs, on the Main method I have: </p>
  
  <pre><code>LogManager.GetLogger("Initialise log4net from the current assembly attributes");
  </code></pre>
  
  <p><strong>On the WCF Service I have this:</strong></p>
  
  <p>The same on the AssemblyInfo.cs as the console project.</p>
  
  <p>Same on Web.config as the App.config on the console project.</p>
  
  <p>On the constructor of the Service1.svc I have:</p>
  
  <pre><code>LogManager.GetLogger("Initialise log4net from the current assembly attributes");
  </code></pre>
  
  <p><strong>This is how my App.config and Web.Config loos like:</strong></p>
  
  <p>inside     the configSections tag:</p>
  
  <pre><code> &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/&gt;
  </code></pre>
  
  <p>and inside the main configuration tag:</p>
  
  <pre><code> &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;
  </code></pre>
  
  <p>How can I solve this?</p>