StaticLoggerBinder.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:greenpepper 作者:
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);
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号