title: log4j2.xml not being picked up by STS
body: <p>I have been trying to get logging to work with a basic configuration via log4j2.xml, in a Spring project. Tried for two days with no luck. The project seems to ignore my log4j2.xml file and pick up the default configuration.</p>
  
  <p>This is what I have been doing:</p>
  
  <ol>
  <li>Created log4j2.xml and added it to the class path. Configuration given below.</li>
  <li>Ensured that this xml file is part of the Deployment Assembly, hoping that it gets picked up</li>
  <li>Unzipped the war file generated to see if the file is being added as part of the deployment... and yes it was.</li>
  </ol>
  
  <p>None helped. I looked up several postings to such problems on StackOverflow but most of it mentioned that all we have to do is add the file to classpath. But in my case, only the default configuration is what I see as being active, when I run the app. To be precise, though the below config says "info", the statement <code>log.info("Inside foo()");</code> doesn't print the message. When I step in, I see that Info level logs are not enabled. </p>
  
  <p>Any help will be greatly appreciated.</p>
  
  <p>==================</p>
  
  <p>log4j2.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration status="INFO"&gt;
      &lt;appenders&gt;
          &lt;Console name="Console" target="SYSTEM_OUT"&gt;
              &lt;PatternLayout pattern="[%d{ISO8601}] [%t] %-5p %c{6} - %msg%n"/&gt;
          &lt;/Console&gt;
          &lt;File name="File" fileName="example.log"&gt;
              &lt;PatternLayout pattern="[%d{ISO8601}] [%t] %-5p %c{6} - %msg%n"/&gt;
          &lt;/File&gt;
      &lt;/appenders&gt;
      &lt;loggers&gt;
          &lt;logger name="com.mypackage" level="info" additivity="false"&gt;
              &lt;appender-ref ref="Console"/&gt;
              &lt;appender-ref ref="File"/&gt;
          &lt;/logger&gt;
          &lt;root level="info"&gt;
              &lt;appender-ref ref="Console"/&gt;
          &lt;/root&gt;
      &lt;/loggers&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <h1>Dependencies in my gradle build script:</h1>
  
  <pre><code>def tomcatVersion = '7.0.42'
  tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
  "org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}"
  tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
      exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'
  }
  
  compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
  compile group: 'com.datastax.cassandra', name: 'cassandra-driver-core', version:'1.0.3'
  //compile group: 'com.yammer.metrics', name: 'metrics-core', version:'2.2.0'
  compile 'org.springframework:spring-core:3.2.3.RELEASE'
  compile 'org.springframework:spring-webmvc:3.2.3.RELEASE'
  compile 'org.springframework.security:spring-security-web:3.2.0.RELEASE'
  compile 'org.springframework.security:spring-security-core:3.2.0.RELEASE'
  compile 'org.springframework.security:spring-security-config:3.2.0.RELEASE'
  compile 'org.springframework.hateoas:spring-hateoas:0.7.0.RELEASE'
  
  providedCompile 'javax.servlet:javax.servlet-api:3.0.1'
  
  runtime 'com.fasterxml.jackson.core:jackson-core:2.2.2'
  runtime 'com.fasterxml.jackson.core:jackson-databind:2.2.2'
  runtime 'javax.xml.bind:jaxb-api:2.2.9'
  
  compile 'org.apache.logging.log4j:log4j-jcl:2.0-rc1'
  runtime 'org.apache.logging.log4j:log4j-jcl:2.0-rc1'
  </code></pre>
  
  <p>//  compile 'org.slf4j:slf4j-api:1.7.5'
  //  runtime 'org.slf4j:slf4j-jdk14:1.7.5'</p>
  
  <pre><code>testCompile group: 'junit', name: 'junit', version: '4.+'
  testCompile 'org.springframework:spring-test:3.2.3.RELEASE'
  testCompile "org.mockito:mockito-all:1.9.5"
  </code></pre>