org.objectweb.util.monolog.api.Logger.setLevel()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中org.objectweb.util.monolog.api.Logger.setLevel()方法的一些代码示例,展示了Logger.setLevel()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.setLevel()方法的具体详情如下:
包路径:org.objectweb.util.monolog.api.Logger
类名称:Logger
方法名:setLevel

Logger.setLevel介绍

[英]Permits to set the level with a Level instance.
[中]允许使用级别实例设置级别。

代码示例

代码示例来源:origin: org.ow2.jonas/jonas-commons

/**
 * Set the given log level to the specified logger.
 * @param loggerName name of the loger to be configured
 * @param level target level
 * @return the previous level of the logger
 */
public static Level setComponentLogLevel(final String loggerName,
                     final Level level) {
  Logger log = Log.getLogger(loggerName);
  Level old = log.getCurrentLevel();
  log.setLevel(level);
  return old;
}

代码示例来源:origin: org.ow2.jonas/jonas-mbeans

/**
 * set Topic Level
 * @param topic topic to set
 * @param level the level to set
 */
public void setTopicLevel(final String topic, final String level) {
  Logger topicLogger = Log.getLoggerFactory().getLogger(topic);
  Level lev = Log.getLevelFactory().getLevel(level);
  // must check null (bug monolog)
  if (lev != null) {
    topicLogger.setLevel(lev);
  } else {
    // TO DO maybe a better error treatement could be found
    throw new RuntimeException("Unknown level " + level);
  }
  // the modified property name is 'logger.topic.level'
  String propName = "logger." + topic + ".level";
  // Send a notification containing the new value of this property to the
  // listener MBean
  sendReconfigNotification(++sequenceNumber, SERVICE_NAME, new PropertiesConfigurationData(propName, level));
}

代码示例来源:origin: org.ow2.jonas/jonas-mbeans

/**
 * set Topic Level
 * @param topic topic to set
 * @param level the level to set
 */
public void setTopicLevel(final String topic, final String level) {
  Logger topicLogger = Log.getLoggerFactory().getLogger(topic);
  Level lev = Log.getLevelFactory().getLevel(level);
  // must check null (bug monolog)
  if (lev != null) {
    topicLogger.setLevel(lev);
  } else {
    // TO DO maybe a better error treatement could be found
    throw new RuntimeException("Unknown level " + level);
  }
  // the modified property name is 'logger.topic.level'
  String propName = "logger." + topic + ".level";
  // Send a notification containing the new value of this property to the
  // listner MBean
  sendReconfigNotification(++sequenceNumber, SERVICE_NAME, new PropertiesConfigurationData(propName, level));
}

代码示例来源:origin: org.objectweb.jonas/jonas-log

/**
 * set Topic Level
 * @param topic topic to set
 * @param level the level to set
 */
public void setTopicLevel(final String topic, final String level) {
  Logger topicLogger = Log.getLoggerFactory().getLogger(topic);
  Level lev = Log.getLevelFactory().getLevel(level);
  // must check null (bug monolog)
  if (lev != null) {
    topicLogger.setLevel(lev);
  } else {
    // TO DO maybe a better error treatement could be found
    throw new RuntimeException("Unknown level " + level);
  }
  // the modified property name is 'logger.topic.level'
  String propName = "logger." + topic + ".level";
  // Send a notification containing the new value of this property to the
  // listner MBean
  sendReconfigNotification(++sequenceNumber, SERVICE_NAME, new PropertiesConfigurationData(propName, level));
}

代码示例来源:origin: org.ow2.petals.dsb/dsb-kernel

@WebMethod
public boolean setLevel(org.petalslink.dsb.ws.api.logger.Logger logger) {
  log.info("Set logger level");
  boolean result = true;
  if (logger != null && logger.getName() != null && logger.getLevel() != null) {
    org.objectweb.util.monolog.Monolog
        .getMonologFactory()
        .getLogger(logger.getName())
        .setLevel(
            org.objectweb.util.monolog.Monolog.getMonologFactory().getLevel(
                logger.getLevel()));
  } else {
    result = false;
  }
  return result;
}

相关文章