com.zusmart.basic.logging.support.Log4jLoggerFactory 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 java.util.Enumeration;
import org.apache.log4j.LogManager;
import com.zusmart.basic.logging.Logger;
import com.zusmart.basic.logging.LoggerFactory;
public class Log4jLoggerFactory extends LoggerFactory {
public Log4jLoggerFactory() {
org.apache.log4j.Logger logger = LogManager.getRootLogger();
if (logger != null) {
Enumeration> appenders = logger.getAllAppenders();
if (appenders == null || appenders.hasMoreElements() == false) {
throw new RuntimeException("No Appenders");
}
}
}
@Override
protected Logger newInstance(String name) {
return new Log4jLogger(org.apache.log4j.Logger.getLogger(name));
}
}