public static Logger getLogger(@SuppressWarnings("rawtypes") Class clazz) {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
URL url = loader.getResource("log4j.properties");
String path;
if (url==null) {
String currPath = LoggerFactory.class.getProtectionDomain().getCodeSource().getLocation().getFile();
File file = new File(currPath);
path = file.getParentFile().getParentFile() + "/conf/log4j.properties";
if (!new File(path).exists()) {
throw new ExceptionInInitializerError("[opencron] error: can not found log4j.properties...");
}
}else {
path = url.getPath();
}
PropertyConfigurator.configure(path);
return org.slf4j.LoggerFactory.getLogger(clazz);
}
LoggerFactory.java 文件源码
java
阅读 33
收藏 0
点赞 0
评论 0
项目:opencron
作者:
评论列表
文章目录