com.zusmart.basic.logging.support.Slf4jLoggerFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zusmart-basic Show documentation
Show all versions of zusmart-basic Show documentation
基础模块,提供配置,日志,SPI,图排序,路径匹配,资源扫描,包扫描,常用工具类
package com.zusmart.basic.logging.support;
import org.slf4j.helpers.NOPLoggerFactory;
import com.zusmart.basic.logging.Logger;
import com.zusmart.basic.logging.LoggerFactory;
public class Slf4jLoggerFactory extends LoggerFactory {
public Slf4jLoggerFactory() {
try {
Class.forName("org.slf4j.impl.StaticLoggerBinder");
} catch (ClassNotFoundException e) {
throw new RuntimeException(e.getMessage(),e);
}
if (org.slf4j.LoggerFactory.getILoggerFactory() instanceof NOPLoggerFactory) {
throw new NoClassDefFoundError("NOPLoggerFactory not supported");
}
}
@Override
protected Logger newInstance(String name) {
return new Slf4jLogger(org.slf4j.LoggerFactory.getLogger(name));
}
}