title: Log4J2 appender not logging to ThreadContext folder
body: <p>I have the following Log4J2 configuration XML:</p>
  
  <pre><code>&lt;Routing name="myAppender"&gt;
      &lt;Routes pattern="$${ctx:workId}"&gt;
          &lt;Route&gt;
              &lt;File fileName="${my-path}/sites/${ctx:workId}/${date:yyyy-MM-dd}/${ctx:employeeId}/emp.log" name="myAppender-${ctx:workId}"&gt;
                  &lt;MarkerFilter marker="TELEMETRIC" onMatch="ACCEPT" onMismatch="DENY"/&gt;
                  &lt;PatternLayout&gt;
                      &lt;Pattern&gt;[%date{ISO8601}][%-5level][%logger{1.}][%marker][$${ctx:employeeId}] %X%m%n&lt;/Pattern&gt;
                  &lt;/PatternLayout&gt;
              &lt;/File&gt;
          &lt;/Route&gt;
      &lt;/Routes&gt;
  &lt;/Routing&gt;
  
  &lt;Async name="Async"&gt;     
      &lt;AppenderRef ref="myAppender" level="info"/&gt;
  &lt;/Async&gt;
  </code></pre>
  
  <p>However whenever the log4j2 appender writes to a file, it doesn't use the proper <code>${ctx:employeeId}</code> string when it writes to the specified file path.</p>
  
  <p>The first time the log4j2 appender writes to a file, it writes to the correct file path specified by <code>${ctx:employeeId}</code>. But whenever information about an employee with another Id is put into the thread context, the appender is still logging to the old file path.</p>
  
  <p>For example the first time the appender logs it writes to the correct path:</p>
  
  <pre><code>D:/example/logs/sites/1/2015-08-22/2/emp.log
  </code></pre>
  
  <p>But when the the logger is logging for the next employee Id (With a new ThreadContext) it is still logging into</p>
  
  <pre><code>D:/example/logs/sites/1/2015-08-22/2/emp.log
  </code></pre>
  
  <p>instead of for example:</p>
  
  <pre><code>D:/example/logs/sites/1/2015-08-22/3/emp.log
  </code></pre>
  
  <p>(Note the employee Id is different.)</p>
  
  <p>In the log output pattern, I log the current employeeId <code>[$${ctx:employeeId}]</code>, as well as what is in the current thread context <code>%X</code>. The output shows that the correct employeeId is being used and is in the ThreadContext, but the appender is not logging to that <code>${ctx:employeeId}</code> file path.</p>
  
  <p>Does anyone know if I am missing anything? Or if I am doing something wrong? Or is this possibly a bug with Log4j2? Thanks for any help!</p>