Do not print log log4j

Background note 

Not a web application, a separate java program

Reported the following error

log4j:WARN No appenders could be found for logger (xxxx).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

 

 

solution

Before calling getLogger. First look at log system initialization 

import org.apache.log4j.xml.DOMConfigurator;

BasicConfigurator.configure();

 

Guess you like

Origin www.cnblogs.com/zhangyy3/p/11005386.html