title: log4j2.properties file is not taken into account while log4j.properties file is
body: <p>I migrated our spring boot application from the web.xml configuration file to java based configuration. In this application we use log4j2 for logging however we also have log4j because of some surrounding system which uses it, so we can not remove it. </p>
  
  <p>After finishing with all the migration the logs were not working. I figured out that I have to add the following code into my application.properties file</p>
  
  <pre><code>logging.level.project.base.package=TRACE
  logging.level.org.springframework=INFO
  logging.level.org.hibernate=INFO
  </code></pre>
  
  <p>Adding all these made logs to appear, however only the property file log4j.properties is recognized and the logs which are using log4j2 have the default logging pattern. </p>
  
  <p>If I remove the log4j.properties file the log4j2 still doesn't work, moreover I get the following warning message</p>
  
  <pre><code>log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.StandardServletEnvironment).
  log4j:WARN Please initialize the log4j system properly.
  </code></pre>
  
  <p>I also tried to specify the config file path in application.properties in bought of the following ways</p>
  
  <pre><code>logging.config=application.properties
  logging.config=classpath:application.properties
  </code></pre>
  
  <p>Our pom.xml dependencies are the following</p>
  
  <pre><code>     &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-starter-logging&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-log4j2&lt;/artifactId&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>We are not running using an embedded tomcat, so we have a config class that extends SpringBootServletInitializer. We use the 2.0.1.RELEASE Spring Boot Version.</p>
  
  <p>Bellow you can find my 2 log4j config files</p>
  
  <p>log4j.properties</p>
  
  <pre><code>conversionPatternShort=OLDLOGGGGER %5p %d %-30C{1}:%4L [%X{username}] - %m%n
  
  ### APPENDER
  log4j.appender.crt=org.apache.log4j.ConsoleAppender
  log4j.appender.crt.layout=org.apache.log4j.PatternLayout
  log4j.appender.crt.layout.ConversionPattern=${conversionPatternShort}
  
  ### Define Levels per package
  log4j.rootLogger=ERROR,crt
  log4j.logger.some.package1=DEBUG,crt
  log4j.logger.some.package2=DEBUG,crt
  </code></pre>
  
  <p>log4j2.properties</p>
  
  <pre><code>status=ERROR
  dest=err
  name=LocalConfig
  
  ### PATTERN
  property.conversionPatternShort=%5p %d %-30C{1}:%4L [%X{username}] - %m%n
  
  ### APPENDER
  appenders=crt
  
  appender.crt.type=Console
  appender.crt.name=crt
  appender.crt.layout.type=PatternLayout
  appender.crt.layout.pattern=${conversionPatternShort1}
  
  ## LOGGER
  ## defining some loggers, foreach logger I have defined 
  ##        (name, level, additivity, appenderRef.crt.ref)
  logger.xxxxx.name=namex
  logger.xxxxx.level=DEBUG
  logger.xxxxx.additivity=false
  logger.xxxxx.appenderRef.crt.ref=crt
  
  logger.yyyyy.name=namey
  logger.yyyyy.level=DEBUG
  logger.yyyyy.additivity=false
  logger.yyyyy.appenderRef.crt.ref=crt
  
  logger.hibernateUtil.name=org.hibernate.engine.jdbc.spi.SqlExceptionHelper
  logger.hibernateUtil.level=ERROR
  logger.hibernateUtil.additivity=false
  logger.hibernateUtil.appenderRef.crt.ref=crt
  
  rootLogger.level=WARN
  rootLogger.appenderRef.crt.ref=crt
  </code></pre>
  
  <p>I really can not find what change made the log4j2 not work anymore. Could you please help?</p>