title: logback change configuration at runtime and log file creation issue
body: <p>I have a logback.xml configuration file that looks like the following : </p>
  
  <pre><code>&lt;configuration&gt;
  
   &lt;property name="defaultPattern"
          value="%d{dd/MM/yyyy HH:mm:ss.SSS} [%thread] %-5level - %msg%n" /&gt;
  
   &lt;!-- Appenders Configuration --&gt;
    &lt;appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"&gt;
      &lt;target&gt;System.err&lt;/target&gt;
      &lt;filter class="com.aleroot.ErrOutFilter" /&gt;
      &lt;encoder&gt;
        &lt;pattern&gt;${defaultPattern}&lt;/pattern&gt;
      &lt;/encoder&gt;
    &lt;/appender&gt;
  
    &lt;appender name="FILE" class="ch.qos.logback.core.FileAppender"&gt;
      &lt;file&gt;aleroot.log&lt;/file&gt;
      &lt;append&gt;true&lt;/append&gt;
      &lt;encoder&gt;
        &lt;pattern&gt;${defaultPattern}&lt;/pattern&gt;
      &lt;/encoder&gt;
    &lt;/appender&gt;
  
  
    &lt;!-- Output Configuration --&gt;
    &lt;root level="debug"&gt;
      &lt;appender-ref ref="FILE" /&gt;
      &lt;appender-ref ref="CONSOLE"/&gt;
    &lt;/root&gt;
  
    &lt;logger name="mainLogger" level="debug"&gt;
      &lt;appender-ref ref="FILE" /&gt;
      &lt;appender-ref ref="CONSOLE"/&gt;
  &lt;/logger&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>i want to change the file property of the <strong>FILE</strong> appender at runtime and add a DatePattern to the filename, i've tried with this code : </p>
  
  <pre><code>LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
            ch.qos.logback.classic.Logger logbackLogger = lc.getLogger("mainLogger");
            FileAppender&lt;ILoggingEvent&gt; fileAppender =
                    (FileAppender&lt;ILoggingEvent&gt;) logbackLogger.getAppender("FILE");
                if(fileAppender != null) {
                  fileAppender.stop();
                  fileAppender.setFile("aleroot-ddMMyyyy.log");
                  fileAppender.setContext(lc);
                  fileAppender.start();
                }
  </code></pre>
  
  <p>The problem is that <em>the file aleroot.log is created anyway also if i have changed the filename</em>, furthermore <em>i get another file that is named exactly : aleroot-ddMMyyyy.log while i want to have a filename like aleroot-04122011.log</em> . How can i achieve that ? </p>
  
  <p>Is there a settings to avoid that the log file will be created at the <code>LoggerFactory.getLogger("mainLogger")</code>  call ? I want that the log file will be created only the first time that i write into the log files, there is no need to create an empty log file .
  The log file should be created the first time that i log something to the log, for example at the first <code>logger.debug("Something.log")</code> .</p>
  
  <p>Is there a settings to achieve that ? </p>