Warn no appenders cocould be found for logger (Org. springframework. Web. Context. contextloader ).

Source: Internet
Author: User

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.