[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