Error:
The following prompt is displayed every time Tomcat is started, but the normal operation of Tomcat is not affected. The prompt is as follows:
Log4j: warn no appenders cocould 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.
Cause:
Previously, log4j configuration was initialized by configuring servlet auto-start, so it may be incompatible with the later spring.
The original configuration is as follows:
<Servlet> <br/> <description> Start and initialize log4j, start a scheduled scan task </description> <br/> <servlet-Name> initservlet </servlet-Name> <br/> <servlet-class> servlet. initservlet </servlet-class> <br/> <init-param> <br/> <param-Name> log4jconfigfile </param-Name> <br/> <param-Value> WEB-INF/log4j. properties </param-value> <br/> </init-param> <br/> <load-on-startup> 1 </load-on-startup> <br/> </servlet> </P> <p> <context-param> <br/> <param-Name> contextconfiglocation </param-Name> <br/> <param- value>/WEB-INF/applicationcontext *. XML </param-value> <br/> </context-param> </P> <p> <listener> <br/> <listener-class> <br/> org. springframework. web. util. log4jconfiglistener <br/> </listener-class> <br/> </listener> </P> <p> <listener> <br/> <listener-class> <br /> Org. springframework. web. context. contextloaderlistener <br/> </listener-class> <br/> </listener>
Solution:
Use the org. springframework. Web. util. log4jconfiglistener configuration instead of the custom initservlet to initialize log4j, that is, delete the initservlet configuration.
<Context-param> <br/> <param-Name> log4jconfiglocation </param-Name> <br/> <param-value>/WEB-INF/log4j. properties </param-value> <br/> </context-param> </P> <p> <listener> <br/> <listener-class> <br/> org. springframework. web. util. log4jconfiglistener <br/> </listener-class> <br/> </listener> <br/>
Note: strictly follow the preceding stepsConfiguration order.