title: Log4j2 auto config
body: <p>I have a problem applying the <em>log4j2.xml</em> auto configuration properly, and I think it has something to do with my folder arrangement.<br>
  I'm using <em>maven</em> to add log4j2 libs and arrange my projects as follows:<br>
  - one project to contain all "common" classes, used by server and client side of my system.<br>
  - another "core" project - the server side application.<br>
  Both projects use the same general package hierarchy (like <em>com.foo.specific.package</em>)</p>
  
  <p>In the Common project I define a logger wrapper:</p>
  
  <pre><code>public class LogWrapper
  {
      static Logger systemParentLogger = LogManager.getLogger("com.foo");
  
      public static Logger getLogger(Class&lt;?&gt; cls)
      {
          return LogManager.getLogger(cls.getName());
      }
  }
  </code></pre>
  
  <p>Moreover, the Common project contains the <em>log4j2.xml</em> file under <strong>META-INF</strong> (alongside the persistence.xml file for Hibernate usage).</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration name="PRODUCTION" status="OFF"&gt;
  
      &lt;appenders&gt;
          &lt;appender type="RollingFile" 
              name="MyFileAppender" 
              fileName="logs/app.log" 
              filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz"&gt;
              &lt;layout type="PatternLayout" pattern="%d %p %C{1.} [%t] %m%n"/&gt;
          &lt;/appender&gt;
      &lt;/appenders&gt;
  
      &lt;loggers&gt;
          &lt;root level="error"&gt;
              &lt;appender-ref ref="MyFileAppender"/&gt;
          &lt;/root&gt;
  
          &lt;logger name="com.foo" level="info" additivity="false"&gt;
              &lt;appender-ref ref="MyFileAppender"/&gt;
          &lt;/logger&gt;
  
          &lt;logger name="org.hibernate" level="error"&gt;
              &lt;appender-ref ref=MyFileAppender"/&gt;
          &lt;/logger&gt;
      &lt;/loggers&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>While running a sample code in the Core project (using the LogWrapper I wrote and some JPA voodoo), I could still see INFO hibernate logs, and no log file was created. I should state that while debugging the code, I could see that the logger fetched was given some weird value "<strong>com.foo.core.persistence.PersistenceXMLTest:ERROR in sun.misc.Launcher$AppClassLoader@2f600492</strong>"</p>