當前位置: 首頁>>代碼示例>>Java>>正文


Java Level.INFO屬性代碼示例

本文整理匯總了Java中ch.qos.logback.classic.Level.INFO屬性的典型用法代碼示例。如果您正苦於以下問題:Java Level.INFO屬性的具體用法?Java Level.INFO怎麽用?Java Level.INFO使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在ch.qos.logback.classic.Level的用法示例。


在下文中一共展示了Level.INFO屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getLogbackLogLevel

private Level getLogbackLogLevel(org.slf4j.event.Level slf4jLevel) {
    if(slf4jLevel.equals(org.slf4j.event.Level.INFO)) return Level.INFO;
    if(slf4jLevel.equals(org.slf4j.event.Level.DEBUG)) return Level.DEBUG;
    if(slf4jLevel.equals(org.slf4j.event.Level.WARN)) return Level.WARN;
    if(slf4jLevel.equals(org.slf4j.event.Level.ERROR)) return Level.ERROR;

    throw new IllegalArgumentException("Unknown log level");
}
 
開發者ID:paypal,項目名稱:butterfly,代碼行數:8,代碼來源:LogbackLogConfigurator.java

示例2: testLogging

@Test
public void testLogging() throws InterruptedException {

    final Logger logger = loggerContext.getLogger("ROOT");

    unit.start();

    assertTrue("appender is started", unit.isStarted());

    for (int i = 0; i<1000; ++i) {
        final LoggingEvent loggingEvent = new LoggingEvent("a.b.c.d", logger, Level.INFO, "message"+i, null, new Object[0]);
        unit.append(loggingEvent);
    }

    final Properties consumerProperties = new Properties();
    consumerProperties.put("metadata.broker.list", kafka.getBrokerList());
    consumerProperties.put("group.id", "simple-consumer-" + new Random().nextInt());
    consumerProperties.put("auto.commit.enable","false");
    consumerProperties.put("auto.offset.reset","smallest");
    consumerProperties.put("zookeeper.connect", kafka.getZookeeperConnection());
    final kafka.consumer.ConsumerConfig consumerConfig = new kafka.consumer.ConsumerConfig(consumerProperties);
    final ConsumerConnector javaConsumerConnector = Consumer.createJavaConsumerConnector(consumerConfig);
    final KafkaStream<byte[], byte[]> log = javaConsumerConnector.createMessageStreamsByFilter(new Whitelist("logs"),1).get(0);
    final ConsumerIterator<byte[], byte[]> iterator = log.iterator();

    for (int i=0; i<1000; ++i) {
        final String messageFromKafka = new String(iterator.next().message(), UTF8);
        assertThat(messageFromKafka, Matchers.equalTo("message"+i));
    }


}
 
開發者ID:wngn123,項目名稱:wngn-jms-kafka,代碼行數:32,代碼來源:KafkaAppenderIT.java

示例3: setLogLevel

/**
 * This method sets the log level (logback).
 */
public void setLogLevel() {
    logLevel = System.getProperty("logLevel", LOG_LEVEL_INFO);
    Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
    Level logLevelSetting;
    switch (logLevel.toLowerCase()) {
    case LOG_LEVEL_ERROR:
        logLevelSetting = Level.ERROR;
        break;
    case LOG_LEVEL_WARN:
        logLevelSetting = Level.WARN;
        break;
    case LOG_LEVEL_ALL:
        logLevelSetting = Level.ALL;
        break;
    case LOG_LEVEL_TRACE_LOG:
        logLevelSetting = Level.TRACE;
        break;
    case LOG_LEVEL_INFO:
        logLevelSetting = Level.INFO;
        break;
    case LOG_LEVEL_DEBUG:
        logLevelSetting = Level.DEBUG;
        break;
    default:
        logLevelSetting = Level.INFO;
        break;
    }
    root.setLevel(logLevelSetting);
}
 
開發者ID:HotelsDotCom,項目名稱:heat,代碼行數:32,代碼來源:LoggingUtils.java


注:本文中的ch.qos.logback.classic.Level.INFO屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。