title: Why are Log4Net entries in a different project's log file?
body: <p>I have a C# project that references another C# project. They both have app.config files that contain log4net configuration settings. When I run my code, only the log file for the main project appears, and the referenced project's log entries appear in the main project's log file.</p>
  
  <p>Here's my app.config for my MainProject:</p>
  
  <pre><code>&lt;configSections&gt;
      &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /&gt;
  &lt;/configSections&gt;
  </code></pre>
  
  <p>...</p>
  
  <pre><code>&lt;log4net&gt;
      &lt;appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"&gt;
          &lt;file value="MainProject.log" /&gt;
          &lt;appendToFile value="true" /&gt;
          &lt;rollingStyle value="Size" /&gt;
          &lt;maxSizeRollBackups value="5" /&gt;
          &lt;maximumFileSize value="100MB" /&gt;
          &lt;staticLogFileName value="true" /&gt;
          &lt;layout type="log4net.Layout.PatternLayout"&gt;
              &lt;conversionPattern value="%level | %date{ISO8601} | %message%newline" /&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
      &lt;root&gt;
          &lt;level value="ALL" /&gt;
          &lt;appender-ref ref="RollingFileAppender" /&gt;
      &lt;/root&gt;
  &lt;/log4net&gt;
  </code></pre>
  
  <p>My main project is an Azure cloud instance project, so it has one class that defines the WorkerRole. The log4net initialization code looks like this:</p>
  
  <pre><code>//Using statements
  //...
  [assembly: log4net.Config.XmlConfigurator(Watch = true)]
  
  namespace MainProject
  {
      public class WorkerRole : RoleEntryPoint
      {
          private static readonly log4net.ILog log4netLogger = log4net.LogManager.GetLogger(typeof(WorkerRole));
  
  //...
  log4netLogger.Info("This is a MainProject log entry")
  //...
  </code></pre>
  
  <p>My referenced project is a class library with one class. Here's the app.config for my ReferencedProject:</p>
  
  <pre><code>&lt;configSections&gt;
      &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /&gt;
  &lt;/configSections&gt;
  </code></pre>
  
  <p>...</p>
  
  <pre><code>&lt;log4net&gt;
      &lt;appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"&gt;
          &lt;file value="ReferencedProject.log" /&gt;
          &lt;appendToFile value="true" /&gt;
          &lt;rollingStyle value="Size" /&gt;
          &lt;maxSizeRollBackups value="5" /&gt;
          &lt;maximumFileSize value="100MB" /&gt;
          &lt;staticLogFileName value="true" /&gt;
          &lt;layout type="log4net.Layout.PatternLayout"&gt;
              &lt;conversionPattern value="%level | %date{ISO8601} | %message%newline" /&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
      &lt;root&gt;
          &lt;level value="ALL" /&gt;
          &lt;appender-ref ref="RollingFileAppender" /&gt;
      &lt;/root&gt;
  &lt;/log4net&gt;
  </code></pre>
  
  <p>The log4net initialization code in the ReferencedProject's one class looks like this:</p>
  
  <pre><code>//Using statements
  //...
  [assembly: log4net.Config.XmlConfigurator(Watch = true)]
  
  namespace ReferencedProject
  {
      public class ReferencedProjectClass : IDisposable
      {
          private static readonly log4net.ILog log4netLogger = log4net.LogManager.GetLogger(typeof(ReferencedProjectClass));
  
  //...
  log4netLogger.Info("This is a ReferencedProject log entry")
  //...
  </code></pre>
  
  <p>When I run this code locally, the only logfile that gets generated is MainProject.log. That logfile has entries from both the MainProject and the ReferencedProject. It looks like this:</p>
  
  <pre><code>INFO | 2017-05-30 07:49:38,419 | This is a ReferencedProject log entry
  INFO | 2017-05-30 07:49:38,421 | This is a MainProject log entry 
  </code></pre>
  
  <p>There's likely something I don't understand about how LogManager.GetLogger manages loggers. Can someone point out what I'm doing wrong?</p>