title: How to run WildFly-8.x with log4j2 & slf4j
body: <p>I like to replace the standard logging mechanism in my <code>WildFly-8.x</code> with <code>log4j2</code>.</p>
  
  <p>My idea of doing this was adding the following jars as modules:</p>
  
  <pre><code>log4j-api-2.3.jar
  log4j-core-2.3.jar
  </code></pre>
  
  <p>and adding a <code>module.xml</code> to have the logger provided by the server. </p>
  
  <p>Since I alredy use <code>slf4j</code> in my application, which is built via Maven, I decided to simply add the following stuff into my <code>pom.xml</code> for building my EAR-file</p>
  
  <pre><code>  &lt;!-- versions are provided via private parent-pom --&gt;
    &lt;!-- slf4j-api --&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
      &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
      &lt;scope&gt;provided&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;!-- slf4j to log4j2, needed??? --&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
      &lt;artifactId&gt;log4j-slf4j-impl&lt;/artifactId&gt;
      &lt;scope&gt;provided&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;!-- log4j2 api, do I really need this??  --&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
      &lt;artifactId&gt;log4j-api&lt;/artifactId&gt;
      &lt;scope&gt;provided&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;!-- log4j2 api, do I really need this?? --&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
      &lt;artifactId&gt;log4j-core&lt;/artifactId&gt;
      &lt;scope&gt;provided&lt;/scope&gt;
    &lt;/dependency&gt;
  </code></pre>
  
  <p>So, a few questions remain:</p>
  
  <p>1.) Do I need additional dependencies in my <code>jboss-deployment-structure.xml</code>, something that looks like this?</p>
  
  <pre><code>[...]
  &lt;ear-subdeployment-isolated&gt;false&lt;/ear-subdeployment-isolated&gt;
  &lt;deployment&gt;
    &lt;dependencies&gt;
      [...]
      &lt;!-- name taken from my introduced module.xml --&gt;
      &lt;module name="org.apache.logging.log4j2" slot="main" export="true" /&gt;
      [...]
    &lt;/dependencies&gt;
  &lt;/deployment&gt;
  </code></pre>
  
  <p>2.) How do I configure log4j2 in my <code>standalone-*.xml</code>? I guess the <code>&lt;loggers/&gt;</code> and <code>&lt;handlers/&gt;</code> will only work with the built-in system?</p>
  
  <p>3.) Do I need to specify the <code>pom.xml</code> snippet above into every maven module where I log something (which is nearly every module where a java class resides)?</p>
  
  <p>And a little "candy" question:
  4.) How do I setup log4j2 to compress logfiles, as it was done with log4j(1)-extras?</p>