The following warning appears when compiling Java or referencing other code:
for Logger (org.apache.zookeeper.ZooKeeper). Log4j:warn Initialize the log4j system Properly.log4j:WARN see http: //logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
This occurs because the log4j configuration is not initialized
This is a warning. If you do not care, if you want to remove or record the log, you need to process in the program.
1. In the SRC Sibling Directory new folder config,config new file log4j.properties, the file content is as follows, each configuration detailed description see: http://www.cnblogs.com/ The likui360/p/7992982.html can be adjusted to suit your needs.
log4j.rootcategory=INFO, stdout, R log4j.appender.stdout=Org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout Log4j.appender.stdout.layout.ConversionPattern=[QC]%p [%t]%c.%m (%l) | %m%N LOG4J.APPENDER.R=Org.apache.log4j.DailyRollingFileAppender Log4j.appender.r.file=d:\\tomcat5.5\\logs\\qc.log log4j.appender.r.layout=org.apache.log4j.PatternLayout 1log4j.appender.r.layout.conversionpattern=%d-[ts]%p%t%c-%m%N Log4j.logger.com.neusoft=DEBUG Log4j.logger.com.opensymphony.oscache=ERROR Log4j.logger.net.sf.navigator=ERROR log4j.logger.org.apache.commons=ERROR log4j.logger.org.apache.struts=WARN Log4j.logger.org.displaytag=ERROR log4j.logger.org.springframework=DEBUG log4j.logger.com.ibatis.db=WARN log4j.logger.org.apache.velocity=FATAL log4j.logger.com.canoo.webtest=WARN log4j.logger.org.hibernate.PS. Preparedstatementcache=WARN log4j.logger.org.hibernate=DEBUG Log4j.logger.org.logicalcobwebs=WARN log4j.rootcategory=INFO, stdout, Rlog4j.appender.stdout=Org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.layout=Org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern=[QC]%p [%t]%c.%m (%l) | %m%N LOG4J.APPENDER.R=Org.apache.log4j.dailyrollingfileappenderlog4j.appender.r.file=d:\\tomcat5.5\\logs\\qc.loglog4j.appender.R.layout=Org.apache.log4j.patternlayout1log4j.appender.r.layout.conversionpattern=%d-[ts]%p%t%c-%m%Nlog4j.logger.com.neusoft=DEBUGlog4j.logger.com.opensymphony.oscache=ERRORlog4j.logger.net.sf.navigator=ERRORlog4j.logger.org.apache.commons=ERRORlog4j.logger.org.apache.struts=WARNlog4j.logger.org.displaytag=ERRORlog4j.logger.org.springframework=DEBUGlog4j.logger.com.ibatis.db=WARNlog4j.logger.org.apache.velocity=FATALlog4j.logger.com.canoo.webtest=WARNlog4j.logger.org.hibernate.PS. Preparedstatementcache=WARNlog4j.logger.org.hibernate=DEBUGlog4j.logger.org.logicalcobwebs=warn
2. Import in the program:
Import Org.apache.log4j.logger;import Org.apache.log4j.priority;import org.apache.log4j.PropertyConfigurator;
3. The first line of the program joins the initialization statement:
Propertyconfigurator.configure ("config/log4j.properties");
Recompile, the output of the content is no longer a warning message, if you want to see the log4j.rootcategory directly set to OFF.
Log4j:warn No Appenders could is found for logger (org.apache.zookeeper.ZooKeeper). Log4j:warn Please initialize the log4j System Properly.log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
The following warning appears in Java: WARN No appenders; WARN Initialize the log4j treatment method