Log4j 使用代码加载配置文件
作者:
ChanHsu | 来源:发表于
2017-04-24 10:12 被阅读60次public class Log4jConfig{
private static final Logger logger = Logger.getLogger(this.getName());
public static void init() {
logger.debug("Read the configuration file log4j.properties! ");
try {
String filepath = System.getProperty("user.dir") + "/config/log4j.properties";
PropertyConfigurator.configure(filepath);
} catch (Exception e) {
e.printStackTrace();
logger.error("Read the configuration file log4j.properties failed: " + e.getMessage());
}
}
}
本文标题:Log4j 使用代码加载配置文件
本文链接:https://www.haomeiwen.com/subject/psiuzttx.html
网友评论