log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
这个错误是在加载spring的contextLoader时没有找到log4j造成的,解决方案:把spring的配置contextConfigLocation放在log4j配置之后就OK了。
<!-- 配置加载log4j.xml文件路径 -->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<!-- 配置log4j.xml变量 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:**/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>