修改org.slf4j.Logger时,修改默认配置文件位置

File logbackFile = new File(ConstantsTools.PATH_LOG_CONFIG);
if (logbackFile.exists()) {
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(lc);
lc.reset();
try {
configurator.doConfigure(logbackFile);
}
catch (JoranException e) {
e.printStackTrace(System.err);
System.exit(-1);
}
}

猜你喜欢

转载自www.cnblogs.com/aloneblog/p/9458245.html