title: Changing log4net file name at runtime without changing the appender
body: <p>I'd like to change the name of my log at runtime without changing the appender. Basically, once it gets to a certain set time of day I'd like to be able to use a different file.</p>
  
  <p>This is what my appender looks like:</p>
  
  <pre><code>&lt;appender name="info" type="log4net.Appender.RollingFileAppender"&gt;
     &lt;file value="logs\" /&gt;
     &lt;datePattern value="yyyyMMdd'_INFO.log'" /&gt;
     &lt;staticLogFileName value="false" /&gt;
     &lt;appendToFile value="true" /&gt;
     &lt;rollingStyle value="Composite" /&gt;
     &lt;maxSizeRollBackups value="10" /&gt;
     &lt;maximumFileSize value="10MB" /&gt;
     &lt;layout type="log4net.Layout.PatternLayout"&gt;
       &lt;conversionPattern value="%newline[%date]-%level-%logger[%M]- Linea:%L - %message%newline"/&gt;
     &lt;/layout&gt;
     &lt;filter type="log4net.Filter.LevelRangeFilter"&gt;
       &lt;param name="LevelMin" value="INFO"/&gt;
       &lt;param name="LevelMax" value="INFO"/&gt;
     &lt;/filter&gt;
   &lt;/appender&gt;
  </code></pre>
  
  <p>This is the function where I iterate through the appenders:</p>
  
  <pre><code>   public void SetLogFile(string fileName)
     {
         foreach (var appender in log.Logger.Repository.GetAppenders())
         {
             try
             {
                 ((log4net.Appender.FileAppender)appender).File = fileName;
                 ((log4net.Appender.FileAppender)appender).ActivateOptions();
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.Message);
             }
         }
     }
  
     SetLogFile("log1.txt");
  </code></pre>
  
  <p>Which creates the following file for this specific example:</p>
  
  <blockquote>
    <p>log1.txt20171221_INFO.log</p>
  </blockquote>
  
  <p>I'd like for my log file to be named <code>log1.txt</code> and not have the <code>datePattern</code> set in the <code>log4net.config</code> file concatenated with the name, but I can't figure out how to do it without changing the <code>log4net.config</code> appender configuration.</p>