Java 类ch.qos.logback.classic.jmx.JMXConfiguratorMBean 实例源码

项目:cassandra-kmean    文件:StorageService.java   
public void setLoggingLevel(String classQualifier, String rawLevel) throws Exception
{
    ch.qos.logback.classic.Logger logBackLogger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(classQualifier);

    // if both classQualifer and rawLevel are empty, reload from configuration
    if (StringUtils.isBlank(classQualifier) && StringUtils.isBlank(rawLevel) )
    {
        JMXConfiguratorMBean jmxConfiguratorMBean = JMX.newMBeanProxy(ManagementFactory.getPlatformMBeanServer(),
                new ObjectName("ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator"),
                JMXConfiguratorMBean.class);
        jmxConfiguratorMBean.reloadDefaultConfiguration();
        return;
    }
    // classQualifer is set, but blank level given
    else if (StringUtils.isNotBlank(classQualifier) && StringUtils.isBlank(rawLevel) )
    {
        if (logBackLogger.getLevel() != null || hasAppenders(logBackLogger))
            logBackLogger.setLevel(null);
        return;
    }

    ch.qos.logback.classic.Level level = ch.qos.logback.classic.Level.toLevel(rawLevel);
    logBackLogger.setLevel(level);
    logger.info("set log level to {} for classes under '{}' (if the level doesn't look like '{}' then the logger couldn't parse '{}')", level, classQualifier, rawLevel, rawLevel);
}
项目:scylla-tools-java    文件:StorageService.java   
public void setLoggingLevel(String classQualifier, String rawLevel) throws Exception
{
    ch.qos.logback.classic.Logger logBackLogger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(classQualifier);

    // if both classQualifer and rawLevel are empty, reload from configuration
    if (StringUtils.isBlank(classQualifier) && StringUtils.isBlank(rawLevel) )
    {
        JMXConfiguratorMBean jmxConfiguratorMBean = JMX.newMBeanProxy(ManagementFactory.getPlatformMBeanServer(),
                new ObjectName("ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator"),
                JMXConfiguratorMBean.class);
        jmxConfiguratorMBean.reloadDefaultConfiguration();
        return;
    }
    // classQualifer is set, but blank level given
    else if (StringUtils.isNotBlank(classQualifier) && StringUtils.isBlank(rawLevel) )
    {
        if (logBackLogger.getLevel() != null || hasAppenders(logBackLogger))
            logBackLogger.setLevel(null);
        return;
    }

    ch.qos.logback.classic.Level level = ch.qos.logback.classic.Level.toLevel(rawLevel);
    logBackLogger.setLevel(level);
    logger.info("set log level to {} for classes under '{}' (if the level doesn't look like '{}' then the logger couldn't parse '{}')", level, classQualifier, rawLevel, rawLevel);
}
项目:GraphTrek    文件:StorageService.java   
public void setLoggingLevel(String classQualifier, String rawLevel) throws Exception
{
    ch.qos.logback.classic.Logger logBackLogger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(classQualifier);

    // if both classQualifer and rawLevel are empty, reload from configuration
    if (StringUtils.isBlank(classQualifier) && StringUtils.isBlank(rawLevel) )
    {
        JMXConfiguratorMBean jmxConfiguratorMBean = JMX.newMBeanProxy(ManagementFactory.getPlatformMBeanServer(),
                new ObjectName("ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator"),
                JMXConfiguratorMBean.class);
        jmxConfiguratorMBean.reloadDefaultConfiguration();
        return;
    }
    // classQualifer is set, but blank level given
    else if (StringUtils.isNotBlank(classQualifier) && StringUtils.isBlank(rawLevel) )
    {
        if (logBackLogger.getLevel() != null || hasAppenders(logBackLogger))
            logBackLogger.setLevel(null);
        return;
    }

    ch.qos.logback.classic.Level level = ch.qos.logback.classic.Level.toLevel(rawLevel);
    logBackLogger.setLevel(level);
    logger.info("set log level to {} for classes under '{}' (if the level doesn't look like '{}' then the logger couldn't parse '{}')", level, classQualifier, rawLevel, rawLevel);
}
项目:stratio-cassandra    文件:StorageService.java   
public void setLoggingLevel(String classQualifier, String rawLevel) throws Exception
{
    ch.qos.logback.classic.Logger logBackLogger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(classQualifier);

    // if both classQualifer and rawLevel are empty, reload from configuration
    if (StringUtils.isBlank(classQualifier) && StringUtils.isBlank(rawLevel) )
    {
        JMXConfiguratorMBean jmxConfiguratorMBean = JMX.newMBeanProxy(ManagementFactory.getPlatformMBeanServer(),
                new ObjectName("ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator"),
                JMXConfiguratorMBean.class);
        jmxConfiguratorMBean.reloadDefaultConfiguration();
        return;
    }
    // classQualifer is set, but blank level given
    else if (StringUtils.isNotBlank(classQualifier) && StringUtils.isBlank(rawLevel) )
    {
        if (logBackLogger.getLevel() != null || hasAppenders(logBackLogger))
            logBackLogger.setLevel(null);
        return;
    }

    ch.qos.logback.classic.Level level = ch.qos.logback.classic.Level.toLevel(rawLevel);
    logBackLogger.setLevel(level);
    logger.info("set log level to {} for classes under '{}' (if the level doesn't look like '{}' then the logger couldn't parse '{}')", level, classQualifier, rawLevel, rawLevel);
}