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


Java Appender.isStarted方法代碼示例

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


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

示例1: configure

import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
/**
 * Configure logging based on a list of builders provided to it. Injects the
 * configured logging to replace the default UIMA loggers, and also sets up
 * metrics on the logging.
 *
 * @param builders
 *            The builders to use to configure the logging
 */
public void configure(List<BaleenLoggerBuilder> builders) {
	// Install JUL to SLF4J handling (JUL is default for UIMA)
	SLF4JBridgeHandler.removeHandlersForRootLogger();
	SLF4JBridgeHandler.install();

	// Configure Logback
	LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
	Logger rootLogger = context.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);

	// Install the level change propagator to reduce the impact of JUL logging
	context.addListener(new LevelChangePropagator());

	// Remove all the existing appenders
	rootLogger.detachAndStopAllAppenders();

	for (BaleenLoggerBuilder builder : builders) {
		PatternLayoutEncoder ple = new PatternLayoutEncoder();
		ple.setCharset(StandardCharsets.UTF_8);
		ple.setContext(context);
		ple.setPattern(builder.getPattern());
		ple.start();

		Appender<ILoggingEvent> appender = builder.build(context, ple);
		if (!appender.isStarted()) {
			appender.start();
		}

		rootLogger.addAppender(appender);
	}

	LOGGER.debug("Adding instrumented metrics for logging");
	// Add an instrumented appender so we get the information about logging
	// through metrics
	InstrumentedAppender instrumentedAppender = new InstrumentedAppender(MetricsFactory.getInstance().getRegistry());
	instrumentedAppender.setContext(context);
	instrumentedAppender.start();
	rootLogger.addAppender(instrumentedAppender);
}
 
開發者ID:dstl,項目名稱:baleen,代碼行數:47,代碼來源:BaleenLogging.java

示例2: isComponentStale

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


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