本文整理汇总了Java中org.slf4j.spi.LoggerFactoryBinder类的典型用法代码示例。如果您正苦于以下问题:Java LoggerFactoryBinder类的具体用法?Java LoggerFactoryBinder怎么用?Java LoggerFactoryBinder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LoggerFactoryBinder类属于org.slf4j.spi包,在下文中一共展示了LoggerFactoryBinder类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.slf4j.spi.LoggerFactoryBinder; //导入依赖的package包/类
private void init() {
String originalLogbackConfigFileValue = System.getProperty(ContextInitializer.CONFIG_FILE_PROPERTY);
System.setProperty(ContextInitializer.CONFIG_FILE_PROPERTY, findURLOfDefaultConfigurationFile());
System.setProperty(GREENPEPPER_DEBUG_SYSPROP, Boolean.toString(GreenPepper.isDebugEnabled()));
// Logback initialisation
try {
Class<?> loggerBinderClass = Class.forName(LOGGER_BINDER_CLASSNAME);
Method getSingletonMethod = loggerBinderClass.getMethod("getSingleton");
internalLoggerBinder = (LoggerFactoryBinder) getSingletonMethod.invoke(null);
} catch (Exception e) {
System.err.print("Unable to instanciate the LoggerFactoryBinder: " + e.getMessage());
throw new IllegalStateException("Wrong configuration of greenpepper logger.", e);
}
if (StringUtils.isNotBlank(originalLogbackConfigFileValue)) {
System.setProperty(ContextInitializer.CONFIG_FILE_PROPERTY, originalLogbackConfigFileValue);
} else {
System.clearProperty(ContextInitializer.CONFIG_FILE_PROPERTY);
}
System.clearProperty(GREENPEPPER_DEBUG_SYSPROP);
}