title: How to configure log4j.xml for migrating from log4j to log4j2?
body: <p>I am working on a application that was using <code>log4j</code> until now and I want to migrate to <code>log4j2</code>. I am a new to using <code>log4j 2</code>, referring the <code>log4j 1.x migration guide</code> but for some parts I am not clear about how the configuration in my <code>log4j.xml</code> should be.</p>
  <p>Current <code>log4j.xml</code> file looks like this:</p>
  <pre><code>
  &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  
  &lt;!DOCTYPE log4j:configuration SYSTEM &quot;log4j.dtd&quot;&gt;
  
  &lt;log4j:configuration xmlns:log4j=&quot;http://jakarta.apache.org/log4j/&quot; debug=&quot;false&quot;&gt;
      
      &lt;!-- Appender for logging to console output  --&gt;
      &lt;appender name=&quot;consoleAppender&quot; class=&quot;org.apache.log4j.ConsoleAppender&quot;&gt;
          &lt;param name=&quot;Threshold&quot; value=&quot;debug&quot; /&gt;
          &lt;layout class=&quot;org.apache.log4j.EnhancedPatternLayout&quot;&gt;
              &lt;param name=&quot;ConversionPattern&quot; value=&quot;[%d{dd-MMM-yyyy HH:mm:ss:SSS}][%5p][%c{1}:%L]- %m%n&quot; /&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
      
      &lt;!-- Appender for logging audit messages to the file  --&gt;
      &lt;appender name=&quot;auditLoggerAppender&quot; class=&quot;org.apache.log4j.rolling.RollingFileAppender&quot;&gt;
          &lt;param name=&quot;Threshold&quot; value=&quot;debug&quot; /&gt;
          
          &lt;rollingPolicy class=&quot;org.apache.log4j.rolling.TimeBasedRollingPolicy&quot;&gt;
              &lt;param name=&quot;ActiveFileName&quot; value=&quot;C:/logs/Filename.log&quot; /&gt; 
              &lt;param name=&quot;FileNamePattern&quot; value=&quot;C:/logs/Filename2.%d.log&quot; /&gt;   
              &lt;param name=&quot;MaxHistory&quot; value=&quot;30&quot; /&gt;  
          &lt;/rollingPolicy&gt;
          
          &lt;layout class=&quot;org.apache.log4j.EnhancedPatternLayout&quot;&gt;
              &lt;param name=&quot;ConversionPattern&quot; value=&quot;[%d{dd-MMM-yyyy HH:mm:ss:SSS}][%5p][%c{1}:%L]- %m%n&quot; /&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
      
      &lt;!-- Logger for audit messages --&gt;
      &lt;logger name=&quot;auditLogger&quot; additivity=&quot;false&quot;&gt;
          &lt;appender-ref ref=&quot;applicationLoggerAppender&quot; /&gt;        
      &lt;/logger&gt;
      
      
  &lt;/log4j:configuration&gt;
  </code></pre>
  <p>what configuration changes need to be made for <code>&lt;param&gt;</code>, <code>&lt;layout&gt;</code>, the <code>&lt;RollinFileAppender&gt;</code> part and <code>&lt;logger name=&quot;auditLogger&quot; additivity=&quot;false&quot;&gt; &lt;appender-ref ref=&quot;applicationLoggerAppender&quot; /&gt;         &lt;/logger&gt;</code> for it to work with log4j 2 ?</p>