Warn no appenders cocould be found for logger Solution

Source: Internet
Author: User
I saw this article on the Internet and wrote it well. It helped me solve my problems. So I reproduced him .. Log4j: warn no appenders cocould be found for logger log4j: Warn please initialize the log4j system properly. "normal" after log4j is configured, start Tomcat and report the preceding error. The message tells me that the appender corresponding to the specified logger is not found in the log4j. properties attribute file, so that I can initialize log4j. However, I have specified the attribute file log4j. properties in the environment variable. The preceding information is reported every time Tomcat is started. Although it is warn information and logs can still be output normally, it is still awkward. It must be a problem in the Environment configuration. Generally, the Program Reports errors. I think it is a human problem, not a computer problem. As a result, I began a difficult journey to find errors. Search for related error information online and find many similar posts. Although the error information is slightly different, the above warning information is common. The related solutions are not very effective either. This problem has plagued me for a long time and I am depressed! Inadvertently, "a clean running environment is very important to the program ." Suddenly I have a feeling of being handsome! It may be that the location of the jar package is incorrect. However, all the places to be put are put. This is where the problem is, that is, where it may not be put. This is a problem that occurs frequently in the work of programmers. in the environment where many programs have been run, the jar packages may be everywhere. If the cleaning is not done in time, it may have unexpected effects on the subsequent programs. Back to the topic, now I think that it is possible that the program has not read the log4j I specified. when the properties property file is started, the log4j-related log4j-1.2.8.jar file is started, so no initialization warning is reported. So where exactly is the execution of the log4j-1.2.8.jar file in advance? Which of the following is the JAR file under C:/Borland/jbuilder2005/thirdparty/jakarta-tomcat-5.0.27/common/lib. This is true. When I delete the JAR file and start Tomcat again, this information will no longer appear. Now let's look back. Why is this happening? My own analysis may be due to the following reasons. Because it is a third-party software integrated in JBuilder, when tomcat in JBuilder is started, it will first automatically find the jar files under the Common/lib folder used in the project, if it is found, load the log4j file before searching for log4j under CONF. properties and other related configuration files. It is because of this that no initialization information is reported. If the JAR file used in the project is not found under common/lib, configure the configuration file under CONF/first, find the JAR file used in the Lib contained in the project. Then, the initialization of log4j is finished, therefore, no initialization warning information is prompted when Tomcat is started. Summary: When configuring various runtime environments, do not think that the jar files to be used will be copied to all the relevant lib folders, which saves a lot of trouble, it is assumed that the configuration will be called automatically when it is used, but there will be a lot of unnecessary troubles and unexpected problems when the relevant configurations are sorted in sequence. Therefore, you must fully understand the purpose of the JAR file and its location. Tip: You can set the following two variables in the environment variable catalina_opts-dlog4j. configuration = file:/C:/Borland/jbuilder2005/thirdparty/jakarta-tomcat-5.0.27/CONF/log4j. properties classpath C:/Borland/jbuilder2005/lib/log4j-1.2.8.jar; but after I run successfully, after I delete these two variables separately, the program is still running normally. If some problems occur during your program running, we recommend that you add these two environment variables.

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.