[Log4j: Warn please initialize the log4j system properly.] Solution

Source: Internet
Author: User

[Problem description]

Configure the log, use slf4j and log4j together, and use c3p0 in the database connection pool to start the server. The following error occurs:Warning:

 
Log4j: warn no appenders cocould be found for logger (COM. mchange. v2.log. mlog). log4j: Warn please initialize the log4j system properly.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/47/B8/wKioL1P-ygvRuZ0hAAF-QDNcL6U100.jpg "Title =" qq20140828141336.png "alt =" wKioL1P-ygvRuZ0hAAF-QDNcL6U100.jpg "/>


[Cause]

Spring uses the open-source framework log4j to output information.


[Solution]

Add the log4j configuration file. Because Maven is used, you need to create the log4j configuration file log4j In the src/main/Java directory. properties (the Java project is created under the src directory), file content:

Log4j. rootcategory = info, console, rollingfile # log4j.logger.com. neusoft. util. log = debuglog4j. logger. consolebrowse = info, consolelog4j. appender. console = org. apache. log4j. leleappenderlog4j. appender. console. layout = org. apache. log4j. patternlayoutlog4j. appender. console. layout. conversionpattern = % d {yyyy-mm-dd hh: mm: SS, SSS} [% P] [% T] % c {1 }:( % m) % nlog4j. appender. rollingfile = org. apache. log4j. rollingfileappenderlog4j. appender. rollingfile. file = logs/agent. log log4j. appender. rollingfile. maxfilesize = 5mblog4j. appender. rollingfile. layout = org. apache. log4j. patternlayoutlog4j. appender. rollingfile. layout. conversionpattern = % d {yyyy-mm-dd hh: mm: SS, SSS} [%-5 p] [% T] % c {1 }:% M % nlog4j. appender. rollingfile. maxbackupindex = 10log4j. logger. errorlog = error, errorloglog4j. appender. errorlog = org. apache. log4j. rollingfileappenderlog4j. appender. errorlog. file = logs/agenterr. loglog4j. appender. errorlog. maxfilesize = 5mblog4j. appender. errorlog. layout = org. apache. log4j. patternlayoutlog4j. appender. errorlog. layout. conversionpattern = % d {yyyy-mm-dd hh: mm: SS, SSS} [%-5 p] [% T] % c {1 }:% M % nlog4j. appender. errorlog. maxbackupindex = 10


This article is from the "forever_love_ing" blog, please be sure to keep this source http://dwf07223.blog.51cto.com/8712758/1546137

[Log4j: Warn please initialize the log4j system properly.] Solution

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.