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


Java Appender.stop方法代碼示例

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


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

示例1: logToConsole

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
/**
 * Starts or stops logging to the console.
 *
 * @param start starts or stops logging to the console.
 */
@SuppressWarnings("rawtypes")
public static void logToConsole(boolean start) {
    Logger rootLogger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
    if (rootLogger != null && rootLogger instanceof ch.qos.logback.classic.Logger) {
        Appender appender = ((ch.qos.logback.classic.Logger) rootLogger).getAppender(CONSOLE_APPENDER_NAME);

        if (appender != null) {
            if (start) {
                appender.start();
            } else {
                appender.stop();
            }

            return;
        }
    }

    logger.warn("Unable to reconfigure Logback console logger (appender name '" + CONSOLE_APPENDER_NAME + "').");
}
 
開發者ID:softelnet,項目名稱:sponge,代碼行數:25,代碼來源:StandaloneUtils.java

示例2: configure

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
/**
 * Initializes the logger and the requested log level.
 *
 * @param level Logging level threshold
 */
@SuppressWarnings("unchecked")
public static void configure(final Level level) {
    final Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
    root.setLevel(level);

    PatternLayoutEncoder encoder = new PatternLayoutEncoder();
    encoder.setContext(root.getLoggerContext());
    encoder.setPattern("%msg%n");
    encoder.start();

    Iterator<Appender<ILoggingEvent>> iterator = root.iteratorForAppenders();

    while (iterator.hasNext()) {
        Appender<ILoggingEvent> appender = iterator.next();
        if (appender instanceof OutputStreamAppender) {
            ((OutputStreamAppender) appender).setEncoder(encoder);
        }
        appender.stop();
        appender.start();
    }
}
 
開發者ID:Nike-Inc,項目名稱:cerberus-lifecycle-cli,代碼行數:27,代碼來源:LoggingConfigurer.java

示例3: detachAndStopAllAppenders

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
/**
 * Remove and processPriorToRemoval all previously attached appenders.
 */
public void detachAndStopAllAppenders() {
  for (Appender<E> a : appenderList) {
    a.stop();
  }
  appenderList.clear();
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:10,代碼來源:AppenderAttachableImpl.java

示例4: testConfiguredAppender

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
@Test
public void testConfiguredAppender() {
  Appender<E> appender = getConfiguredAppender();
  appender.start();
  assertTrue(appender.isStarted());
 
  appender.stop();
  assertFalse(appender.isStarted());
  
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:11,代碼來源:AbstractAppenderTest.java

示例5: removeAllAppenders

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
/**
 * Remove all previously added appenders from this logger instance. <p/> This
 * is useful when re-reading configuration information.
 */
public synchronized void removeAllAppenders() {
  if (appenderList != null) {
    int len = appenderList.size();
    for (int i = 0; i < len; i++) {
      Appender<ILoggingEvent> a = appenderList.get(i);
      a.stop();
    }
    appenderList.clear();
    appenderList = null;
  }
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:16,代碼來源:HLogger.java

示例6: stop

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
@Override
public void stop() {
  for (Appender<E> appender : appenderTracker.allComponents()) {
    appender.stop();
  }
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:7,代碼來源:SiftingAppenderBase.java

示例7: processPriorToRemoval

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
@Override
protected void processPriorToRemoval(Appender<E> component) {
  component.stop();
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:5,代碼來源:AppenderTracker.java


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