title: .net core 2.1 log4net with multip environments
body: <p>I'm working on a .net core 2.1 application and trying to incorporate log4net to write logs to files.  I can get it to work but can't figure out how to write to different environments (i.e. test/production) where the logs will be in different locations.</p>
  
  <p>log4net.config</p>
  
  <pre><code>&lt;log4net&gt;
      &lt;root&gt;
          &lt;appender-ref ref="console" /&gt;
      &lt;appender-ref ref="file" /&gt;
    &lt;/root&gt;
    &lt;appender name="console" type="log4net.Appender.ConsoleAppender"&gt;
      &lt;layout type="log4net.Layout.PatternLayout"&gt;
        &lt;conversionPattern value="%date %level - %message%newline" /&gt;
      &lt;/layout&gt;
      &lt;threshold value="Info" /&gt;
    &lt;/appender&gt;
    &lt;appender name="file" type="log4net.Appender.RollingFileAppender"&gt;
      &lt;file value="C:\logs\TestLocation\MyLog.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="%date [%thread] %level - %message%newline" /&gt;
      &lt;/layout&gt;
      &lt;threshold value="Info" /&gt;
    &lt;/appender&gt;
  &lt;/log4net&gt;
  </code></pre>
  
  <p>my startup.cs configure method is:</p>
  
  <pre><code>loggerFactory.AddLog4Net();
  </code></pre>
  
  <p>I inject the logger into my controller:</p>
  
  <pre><code> public MyController(ILogger&lt;MyController&gt; logger)
   {
       _logger = logger;
   }
  </code></pre>
  
  <p>and use it in my controller:</p>
  
  <pre><code>_logger.LogInformation("My logger worked!!!!!!!!!!!");
  </code></pre>
  
  <p>This all works fine.  I was hoping I could just add a new log4net.config file and just name it log4net.Production.config and the application would use the different config file depending on the environment that it's in like appnsettings.json. Instead it just uses my default log4net.config file.</p>
  
  <p>Is it possible to have multiple log4net.config files for each environment like appsettings.json?</p>