title: Under Spring Framework: WARN: WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader)
body: <p>I have spent all day trying to solve the logging problem I'm having with log4j in a webapp.  No matter what I do, I cannot get rid of the following:</p>
  
  <pre><code>log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
  log4j:WARN Please initialize the log4j system properly.
  log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
  </code></pre>
  
  <p>Just to be clear, I have read all of the articles here on Stack Overflow addressing this issue.  I've read the log4j manual.  I've been through a dozen different tutorials.  I've tried the properties approach and the XML approach (log4j.properties and log4j.xml, respectively).  Also, I have confirmed that the log4j.xml file is being read.  Aside from the fact that the server tells me so during startup, I can influence the level of feedback through the .xml file.  So, yes, the log4j.xml file is in the CLASSPATH.</p>
  
  <p>I know I'm missing something simple and fundamental.  Below are the relevant files:</p>
  
  <p>LOG4J.XML (/WEB-INF):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd"&gt;
  &lt;log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"&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;!-- Application Loggers --&gt;
  &lt;logger name="com.tiersoftinc.testlog"&gt;
      &lt;level value="info" /&gt;      
  &lt;/logger&gt;
  
  &lt;!-- 3rdparty Loggers --&gt;
  &lt;logger name="org.springframework.core"&gt;
      &lt;level value="info" /&gt;      
  &lt;/logger&gt;
  
  &lt;logger name="org.springframework.beans"&gt;
      &lt;level value="info" /&gt;      
  &lt;/logger&gt;
  
  &lt;logger name="org.springframework.context"&gt;
      &lt;level value="info" /&gt;      
  &lt;/logger&gt;
  
  &lt;logger name="org.springframework.web"&gt;
      &lt;level value="info" /&gt;      
  &lt;/logger&gt;
  
  &lt;!-- Root Logger --&gt;
  &lt;root&gt;
      &lt;priority value="warn" /&gt;
      &lt;appender-ref ref="console" /&gt;
  &lt;/root&gt;
  
  &lt;/log4j:configuration&gt;
  </code></pre>
  
  <p>and WEB.XML (/WEB-INF):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
  
  &lt;!-- The definition of the Root Spring Container shared by all Servlets and Filters, and the applicationContext.xml file --&gt;
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;
          /WEB-INF/spring/root-context.xml
          /WEB-INF/spring/app-context.xml         
      &lt;/param-value&gt;      
  &lt;/context-param&gt;    
  
  &lt;!-- Logging listener --&gt;
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.util.Log4jConfigListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  &lt;context-param&gt;
      &lt;param-name&gt;log4jConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;/WEB-INF/log4j.xml&lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;!-- Creates the Spring Container shared by all Servlets and Filters --&gt;
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;      
  &lt;/listener&gt;
  
  &lt;!-- Processes application requests --&gt;
  &lt;servlet&gt;
      &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/spring/appServlet/servlet-context.xml&lt;/param-value&gt;           
      &lt;/init-param&gt;       
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;  
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>and APP-CONTEXT.XML (/WEB-INF/spring):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:mvc="http://www.springframework.org/schema/mvc"
  xmlns:p="http://www.springframework.org/schema/p"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd"&gt;
  
  &lt;!-- Activates various annotations to be detected in bean classes --&gt;   
  &lt;context:annotation-config /&gt;   
  
  &lt;!-- Scans the classpath for annotated components that will be auto-registered as Spring beans. 
  For example @Controller and @Service. Make sure to set the correct base-package --&gt; 
  &lt;context:component-scan base-package="com.tiersoftinc.gridlab3" /&gt;   
  
  &lt;!-- Configures the annotation-driven Spring MVC Controller programming model.  
  Note that, with Spring 3.0, this tag works in Servlet MVC only! --&gt; 
  &lt;mvc:annotation-driven /&gt;
  
  &lt;mvc:resources mapping="/resources/**" location="/resources/" /&gt;        
  
  &lt;!-- Imports datasource configuration --&gt;   
  &lt;import resource="app-context-mongo.xml"/&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>and APP-CONTEXT-MONGO.XML (/WEB-INF/spring):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:p="http://www.springframework.org/schema/p"
  xmlns:c="http://www.springframework.org/schema/c"
  xmlns:tx="http://www.springframework.org/schema/tx"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:mongo="http://www.springframework.org/schema/data/mongo"
  xmlns:util="http://www.springframework.org/schema/util"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
                      http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                      http://www.springframework.org/schema/tx
                      http://www.springframework.org/schema/tx/spring-tx-3.1.xsd                      
                      http://www.springframework.org/schema/context                       
                      http://www.springframework.org/schema/context/spring-context-3.1.xsd                        
                      http://www.springframework.org/schema/data/mongo                        
                      http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd                       
                      http://www.springframework.org/schema/util                      
                      http://www.springframework.org/schema/util/spring-util-3.1.xsd"&gt;    
  
  &lt;!-- Activate Spring Data MongoDB repository support --&gt;
  &lt;mongo:repositories base-package="com.tiersoftinc.gridlab3.repository" /&gt;
  
  &lt;bean id="propertyPlaceholderConfigurer"   
      class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;  
      &lt;property name="locations"&gt;  
          &lt;list&gt;  
              &lt;value&gt;/WEB-INF/spring/database.properties&lt;/value&gt;  
          &lt;/list&gt;  
      &lt;/property&gt; 
  &lt;/bean&gt;  
  
  &lt;!-- MongoDB host --&gt;
  &lt;mongo:mongo host="${mongo.host.name}" port="${mongo.host.port}"/&gt; 
  
  &lt;!-- Template for performing MongoDB operations --&gt;
  &lt;bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate"
  
  c:mongo-ref="mongo" c:databaseName="${mongo.db.name}"/&gt;
  
  &lt;!-- Service for initializing MongoDB with sample data using MongoTemplate --&gt;
  &lt;bean id="initGridLab3Service" class="com.tiersoftinc.gridlab3.services.InitGridLab3Service" init-method="init"/&gt;   
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>and, finally, ROOT-CONTEXT.XML (/WEB-INF/spring):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:context="http://www.springframework.org/schema/context"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd"&gt;    
  
  &lt;!-- Root Context: defines shared resources visible to all other web components --&gt;     
  &lt;context:annotation-config /&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>What am I missing?</p>
  
  <p>Thank you.</p>