本文整理匯總了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);
}
示例2: isComponentStale
import ch.qos.logback.core.Appender; //導入方法依賴的package包/類
@Override
protected boolean isComponentStale(Appender<E> appender) {
return !appender.isStarted();
}