Log4j:warn No appenders could be found for logger

Source: Internet
Author: User
Tags log4j

Log4j.appender.stdout=org.apache.log4j.consoleappender log4j.appender.stdout.layout= Org.apache.log4j.PatternLayout log4j.appender.stdout.layout.conversionpattern=%d%p [%c]-%m%n

Log4j.appender.logfile=org.apache.log4j.fileappender Log4j.appender.logfile.file=target/spring.log Log4j.appender.logfile.layout=org.apache.log4j.patternlayout log4j.appender.logfile.layout.conversionpattern=%d %p [%c]-%m%n
=============================== re-released, OK, no hint. Once you have added this profile, the warnings on the program run will disappear. Especially in the web layer development, only when the file is added to see the spring background complete error message. When developing a spring consolidation application, you often encounter a situation where 404 errors occur but you don't see any error messages, and you need to check that the file is not there.
When developing related projects in Eclipse, you often see the following information in the console: Log4j:warn No appenders could is found for logger Log4j:warn please initialize the log4j sy Stem properly.

The output information here is not an error message but only a warning message, because log4j cannot output the log, log4j is a log input package. You can extract a compressed package such as struts or hibernate, have a log4j.properties file inside it, copy it to the Project Src folder, or put Log4j.properties in the \web-inf\classes folder.
=================================== WARN No appenders could be found for logger solution

These days to do an SSH project, Tomcat started with the following issues: Log4j:warn No appenders could be found for logger ( Org.springframework.web.context.ContextLoader). Log4j:warn Please initialize the log4j system properly.

Check on the Internet, much is said to change the Contextloaderlistener to Springcontextservlet, but I changed the useless. Later on an English website to see a post on the same issue, he changed:

<context-param> <param-name>log4jConfigLocation</param-name> <param-value>/web-inf/ Config/log4j.properties</param-value> </context-param>

······

<!--definition log4j listener--<listener> <listener-class> Org.springframework.web.util.Log4jConfigListener & Lt;/listener-class> </listener>

This changed the problem to solve, no need to modify the Contextloaderlistener.

Log4j:warn No appenders could be found for logger

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.