title: No logging and repository root has appender but Logger has no appender
body: <p>I'm sure I'm missing something basic.  I'm trying to enable log4net logging as part of an XUnit integration test, but no log file is getting written to disk.  </p>
  
  <p>I've tried specifying the log configuration using both using a config file and programmatically:</p>
  
  <p><strong>Config file:</strong></p>
  
  <pre><code> &lt;log4net&gt;
    &lt;root&gt;
      &lt;level value="INFO" /&gt;
      &lt;appender-ref ref="console" /&gt;
      &lt;appender-ref ref="file" /&gt;
    &lt;/root&gt;
    &lt;appender name="file" type="log4net.Appender.RollingFileAppender"&gt;
      &lt;file value="mylog.log" /&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="%date [%thread] %level %logger - %message%newline" /&gt;
      &lt;/layout&gt;
    &lt;/appender&gt;
  &lt;/log4net&gt;
  </code></pre>
  
  <p><strong>Programatically</strong></p>
  
  <pre><code>    private void ConfigureAppender()
      {
          var layout = new PatternLayout("%date [%thread] %level %logger - %message%newline");
          var appender = new RollingFileAppender {Name = "file", File = "c:\\temp\\mylog.log", AppendToFile = true, RollingStyle = RollingFileAppender.RollingMode.Size, MaxSizeRollBackups = 5, MaximumFileSize = "10MB", StaticLogFileName = true, Layout = layout};
          var repository = LogManager.GetRepository() as Hierarchy;
          repository.Root.AddAppender(appender);
          repository.Root.Level = Level.Info;
          repository.Configured = true;
          repository.RaiseConfigurationChanged(EventArgs.Empty);
      }
  </code></pre>
  
  <p>I then get the logger, as early in the program execution as possible, using something like this (I've tried <code>[assembly: XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]</code> as well):</p>
  
  <pre><code>        var fileInfo = new FileInfo("log4net.config");
          if (!fileInfo.Exists) throw new Exception();
          XmlConfigurator.Configure(fileInfo);
          var log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
          log.Fatal("This is a test");
  </code></pre>
  
  <p>No logs either way.  Whether I define the logging via config or programmatically, I see the screenshot at bottom when I inspect the log object.  Note the following:</p>
  
  <ol>
  <li>The level settings have been picked up from the config definition.</li>
  <li>The repository root has the two appenders as defined in the config definition.</li>
  <li>The Logger instance itself has no appenders.  </li>
  </ol>
  
  <p>Can someone please tell me what I'm missing?</p>
  
  <p><a href="https://i.stack.imgur.com/ALFYY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ALFYY.png" alt="enter image description here"></a></p>
  
  <p><strong>EDIT:</strong>
  This is what I missed, as determined from Z.R.T.'s answer:</p>
  
  <ul>
  <li>I needed a <code>logger</code> element in the log4net.config/app.config.  </li>
  <li>I needed to reference the logger by name, e.g. <code>LogManager.GetLogger("IntegrationLogger");</code>.</li>
  </ul>
  
  <p>Once I added these two things, log4net started working. The only downside is that all the logs are marked with "IntegrationLogger" instead of the class in which the log is generated, but this at least got the logging started.  </p>