title: Log4j2.xml configuration file location for EAR
body: <p>I have a Java EE application packaged with ejbs and war. Following is the structure of the EAR:</p>
  
  <pre><code>myapp.ear
  -lib
  -META-INF
  -ejbjar1.jar
  -ejbjar2.jar
  -mywebapp.war
  </code></pre>
  
  <p>I need to use log4j2 so I have tried to configure it at first from the web.xml by following <a href="https://logging.apache.org/log4j/2.0/manual/webapp.html" rel="nofollow">instructions to initialize Log4j 2 in a web application</a> but when I am creating the <code>Logger</code> in an EJB it is throwing:</p>
  
  <pre><code>ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
  </code></pre>
  
  <p>The instruction given <a href="https://logging.apache.org/log4j/2.0/manual/logsep.html#Java_EE_Applications" rel="nofollow">here</a> is not much clear to me, but what I understand that I need to place the log4j2.xml in a shared location.</p>
  
  <p>I have tried to place the xml inside the EAR, inside the EAR/lib, inside the EAR/META-INF but I got same result. In these case I haven't configured anything in the web.xml.</p>
  
  <p>How can I configure log4j2 for an EAR so that the configuration will be available for all the classes (classes for ejb-module, web-module)?</p>
  
  <p>I am using Weblogic 12C. Previously I have successfully used log4j2 in Weblogic 11G but in that case the packaging was a WAR file.</p>