logback 源码--看配置文件logback.xml的加载位置

前端之家收集整理的这篇文章主要介绍了logback 源码--看配置文件logback.xml的加载位置前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

public abstract class AbstractLifeCycle implements LifeCycle
{
private static final Logger LOG = Log.getLogger(AbstractLifeCycle.class);//触发log初始化动作
public static final String STOPPED="STOPPED";
public static final String Failed="Failed";
public static final String STARTING="STARTING";
public static final String STARTED="STARTED";
public static final String STOPPING="STOPPING";

public static final String RUNNING="RUNNING";


Thread [main] (Suspended)

ContextInitializer.getResource(String,ClassLoader,boolean) line: 139
ContextInitializer.findURLOfDefaultConfigurationFile(boolean) line: 133
ContextInitializer.autoConfig() line: 146
StaticLoggerBinder.init() line: 85
StaticLoggerBinder.<clinit>() line: 55
LoggerFactory.bind() line: 128
LoggerFactory.performInitialization() line: 107
LoggerFactory.getILoggerFactory() line: 295
LoggerFactory.getLogger(String) line: 269
Slf4jLog.<init>(String) line: 38
Slf4jLog.<init>() line: 32
NativeConstructorAccessorImpl.newInstance0(Constructor,Object[]) line: not available [native method]
NativeConstructorAccessorImpl.newInstance(Object[]) line: 57
DelegatingConstructorAccessorImpl.newInstance(Object[]) line: 45
Constructor<T>.newInstance(Object...) line: 526
Class<T>.newInstance() line: 374
Log.initialized() line: 161
Log.getLogger(String) line: 435
Log.getLogger(Class<?>) line: 425
AbstractLifeCycle.<clinit>() line: 33
JettyServerBoot$JettyFactory.createServerInSource(int,String) line: 70
JettyServerBoot.start(int,String,String[]) line: 37
QuickStartServer.main(String[]) line: 17

//logback-classic-1.0.13-sources.jar

//获取配置文件()

public class ContextInitializer {
final public static String GROOVY_AUTOCONFIG_FILE = "logback.groovy";
final public static String AUTOCONFIG_FILE = "logback.xml";//自动查找classpath下的配置文件名字
final public static String TEST_AUTOCONFIG_FILE = "logback-test.xml";
final public static String CONFIG_FILE_PROPERTY = "logback.configurationFile";
final public static String STATUS_LISTENER_CLASS = "logback.statusListenerClass";
final public static String SYSOUT = "SYSOUT";

ch.qos.logback.classic.util.ContextInitializer.findURLOfDefaultConfigurationFile(boolean)

public URL findURLOfDefaultConfigurationFile(boolean updateStatus) {

ClassLoader myClassLoader = Loader.getClassLoaderOfObject(this);
URL url = findConfigFileURLFromSystemProperties(myClassLoader,updateStatus);
if (url != null) {
return url;
}


url = getResource(GROOVY_AUTOCONFIG_FILE,myClassLoader,updateStatus);
if (url != null) {
return url;
}


url = getResource(TEST_AUTOCONFIG_FILE,updateStatus);
if (url != null) {
return url;
}

//file:/F:/work/XXweb/target/classes/logback.xml
return getResource( AUTOCONFIG_FILE,updateStatus); }
原文链接:https://www.f2er.com/xml/293303.html

猜你在找的XML相关文章