title: Spring : Logging not working with log4j or logback
body: <p>I am working on a Spring-MVC application in which I am trying to get logging working again. Unfortunately, sometime back it just stopped working, I don't know what is causing that. I tried some suggestions on net, but nothing useful. Any suggestions?</p>
  
  <p>Pom.xml :</p>
  
  <pre><code>&lt;packaging&gt;war&lt;/packaging&gt;
      &lt;properties&gt;
          &lt;java-version&gt;1.8&lt;/java-version&gt;
          &lt;org.springframework-version&gt;4.1.6.RELEASE&lt;/org.springframework-version&gt;
          &lt;org.aspectj-version&gt;1.7.4&lt;/org.aspectj-version&gt;
          &lt;org.slf4j-version&gt;1.7.5&lt;/org.slf4j-version&gt;
          &lt;hibernate.version&gt;4.3.9.Final&lt;/hibernate.version&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;springsecurity.version&gt;4.0.1.RELEASE&lt;/springsecurity.version&gt;
          &lt;spring-platform.version&gt;1.1.3.RELEASE&lt;/spring-platform.version&gt;
          &lt;jetty.version&gt;9.2.9.v20150224&lt;/jetty.version&gt;
      &lt;/properties&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;io.spring.platform&lt;/groupId&gt;
          &lt;artifactId&gt;platform-bom&lt;/artifactId&gt;
          &lt;version&gt;1.1.3.RELEASE&lt;/version&gt;
          &lt;relativePath /&gt;
      &lt;/parent&gt;
  
      &lt;dependencies&gt;
  
    &lt;!-- Spring framework dependencies --&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.mobile&lt;/groupId&gt;
              &lt;artifactId&gt;spring-mobile-device&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
              &lt;artifactId&gt;spring-data-redis&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Spring security dependencies --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-config&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-taglibs&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
  
      &lt;!-- Logging --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
              &lt;version&gt;1.7.5&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;jcl-over-slf4j&lt;/artifactId&gt;
              &lt;version&gt;1.7.5&lt;/version&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
              &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
              &lt;version&gt;1.0.13&lt;/version&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
              &lt;artifactId&gt;logback-core&lt;/artifactId&gt;
              &lt;version&gt;1.0.13&lt;/version&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;apache-log4j-extras&lt;/artifactId&gt;
              &lt;version&gt;1.1&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>I have both log4j.xml and logback.xml :</p>
  
  <p>log4j.xml :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE log4j:configuration SYSTEM "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd"&gt;
  &lt;log4j:configuration&gt;
  
  
      &lt;!-- Appenders --&gt;
      &lt;appender name="console" class="org.apache.log4j.ConsoleAppender"&gt;
          &lt;param name="Target" value="System.out" /&gt;
          &lt;layout class="org.apache.log4j.PatternLayout"&gt;
              &lt;param name="ConversionPattern" value="%-5p: %c - %m%n" /&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
    &lt;logger name="org.cometd"&gt;
          &lt;level value="debug"/&gt;
      &lt;/logger&gt;
      &lt;!-- Root Logger --&gt;
      &lt;root&gt;
          &lt;priority value="OFF" /&gt;
          &lt;appender-ref ref="console" /&gt;
      &lt;/root&gt;
  
  &lt;/log4j:configuration&gt;
  </code></pre>
  
  <p>logback.xml :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration&gt;
      &lt;include resource="org/springframework/boot/logging/logback/base.xml"/&gt;
  
  
      &lt;logger name="org.cometd" level="debug"/&gt;
      &lt;logger name="com.tooltank.spring.chat.ChatServiceImpl" level="info"/&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>During server startup I get this :</p>
  
  <pre><code>SLF4J: Class path contains multiple SLF4J bindings.
  SLF4J: Found binding in [jar:file:/home/logback-classic-1.0.13.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  SLF4J: Found binding in [jar:file:/home//WEB-INF/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  13:43:29,173 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
  13:43:29,173 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
  13:43:29,174 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/home/path/to/logback.xml]
  13:43:29,292 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
  13:43:29,298 |-ERROR in ch.qos.logback.core.joran.action.IncludeAction - Could not find resource corresponding to [org/springframework/boot/logging/logback/base.xml]
  SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
  13:43:29,299 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.cometd] to DEBUG
  13:43:29,299 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.tooltank.spring.chat.ChatServiceImpl] to INFO
  13:43:29,299 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
  13:43:29,300 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@59474a9e - Registering current configuration as safe fallback point
  </code></pre>
  
  <p>What am I missing? Thank you. </p>