Eclipse: log4j: WARN No appenders cocould be found for logger, log4jappenders

Source: Internet
Author: User

Eclipse: log4j: WARN No appenders cocould be found for logger, log4jappenders
Create a file named log4j. properties under src with the following content:

# Configure logging for testing: optionally with log file
Log4j. rootLogger = WARN, stdout
Log4j. rootLogger = INFO, stdout

Log4j. appender. stdout = org. apache. log4j. leleappender
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-release, OK, no prompt. After the configuration file is added, the warning on running the program again disappears. Especially for Web layer development, the complete error information in the Spring background can be seen only after this file is added. Integrate applications in Spring development
When a 404 error occurs, but no error information is displayed, you need to check
Whether the file exists.

When developing related projects in Eclipse, the following information is often displayed on the console:
Log4j: WARN No appenders cocould be found for logger
Log4j: WARN Please initialize the log4j system properly.

The output is not an error message, but only a warning message. Because log4j cannot output logs, log4j is a log input software package. You can decompress the Struts or Hibernate compressed package, there is a log4j. properties file, copy it to the src folder of the project or put log4j. properties in the \ WEB-INF \ classes folder.

==========================================
WARN No appenders cocould be found for logger Solution

In the past few days, an SSH project has encountered the following problems during tomcat startup:
Log4j: WARN No appenders cocould be found for logger (org. springframework. web. context. ContextLoader ).
Log4j: WARN Please initialize the log4j system properly.

I checked it on the Internet. I often changed ContextLoaderListener to SpringContextServlet, but it is useless to change it like this. Later, I saw a post with the same problem on an English website. He changed it like this:

<Context-param>
<Param-name> log4jConfigLocation </param-name>
<Param-value>/WEB-INF/config/log4j. properties </param-value>
</Context-param>

······

<! -- Define the LOG4J listener -->
<Listener>
<Listener-class>
Org. springframework. web. util. Log4jConfigListener
</Listener-class>
</Listener>

In this way, the problem is solved, and you do not need to modify the ContextLoaderListener.


Log4j problems in Java: log4j: WARN No appenders cocould be found for logger

That is to say, your project does not support Log4j
If you want to support it, put the Log4j attribute file in the classpath directory, and other directories are invalid.
If you do not plan to use Log4j, ignore the warning information.

Log4j: How can WARN No appenders cocould be found for logger solve this problem ??

Configure log4j. properties. For more information, see
Www.blogjava.net/..7.html
 

Related Article

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.