本文整理匯總了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 + "').");
}
示例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();
}
}
示例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();
}
示例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());
}
示例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;
}
}
示例6: stop
import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
@Override
public void stop() {
for (Appender<E> appender : appenderTracker.allComponents()) {
appender.stop();
}
}
示例7: processPriorToRemoval
import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
@Override
protected void processPriorToRemoval(Appender<E> component) {
component.stop();
}