本文整理了Java中ch.qos.logback.core.Appender.getCopyOfAttachedFiltersList()
方法的一些代码示例,展示了Appender.getCopyOfAttachedFiltersList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Appender.getCopyOfAttachedFiltersList()
方法的具体详情如下:
包路径:ch.qos.logback.core.Appender
类名称:Appender
方法名:getCopyOfAttachedFiltersList
暂无
代码示例来源:origin: co.cask.cdap/cdap-watchdog
@Override
public List<Filter<E>> getCopyOfAttachedFiltersList() {
return delegate.getCopyOfAttachedFiltersList();
}
代码示例来源:origin: caskdata/cdap
@Override
public List<Filter<E>> getCopyOfAttachedFiltersList() {
return delegate.getCopyOfAttachedFiltersList();
}
代码示例来源:origin: com.haulmont.cuba/cuba-global
@Override
public void setAppenderThreshold(String appenderName, Level threshold) throws AppenderThresholdNotSupported {
for (Map.Entry<String, Appender> entry : getAllAppenders().entrySet()) {
if (entry.getKey().equals(appenderName)) {
Appender appender = entry.getValue();
for (Object filter : appender.getCopyOfAttachedFiltersList()) {
if (filter instanceof ThresholdFilter) {
((ThresholdFilter) filter).setLevel(threshold.levelStr);
return;
}
}
}
}
throw new AppenderThresholdNotSupported(appenderName);
}
代码示例来源:origin: com.haulmont.cuba/cuba-global
@Override
public Level getAppenderThreshold(String appenderName) throws AppenderThresholdNotSupported {
for (Map.Entry<String, Appender> entry : getAllAppenders().entrySet()) {
if (entry.getKey().equals(appenderName)) {
Appender appender = entry.getValue();
for (Object filter : appender.getCopyOfAttachedFiltersList()) {
if (filter instanceof ThresholdFilter) {
try {
Field field = filter.getClass().getDeclaredField("level");
field.setAccessible(true);
return (Level) field.get(filter);
} catch (NoSuchFieldException | IllegalAccessException e) {
log.error("Error getting appender " + appenderName + " level", e);
throw new AppenderThresholdNotSupported(appenderName);
}
}
}
}
}
throw new AppenderThresholdNotSupported(appenderName);
}
代码示例来源:origin: apache/jackrabbit-oak
public void finished() {
if (thFilter==null) {
// then we did not add it
return;
}
List<Filter<ILoggingEvent>> filterList = appender.getCopyOfAttachedFiltersList();
appender.clearAllFilters();
for (Iterator<Filter<ILoggingEvent>> it = filterList.iterator(); it.hasNext();) {
Filter<ILoggingEvent> filter = it.next();
if (filter!=thFilter) {
appender.addFilter(filter);
}
}
}
}
代码示例来源:origin: dstl/baleen
@Test
public void testAbstractAndConsoleMultipleFilters() {
BaleenConsoleLoggerBuilder builder =
new BaleenConsoleLoggerBuilder(
NAME,
BaleenLogging.DEFAULT_PATTERN,
Arrays.asList(
new MinMaxFilter(Level.INFO, Level.ERROR),
new MinMaxFilter(Level.INFO, Level.WARN)));
LoggerContext context = new LoggerContext();
Encoder<ILoggingEvent> encoder = new PatternLayoutEncoder();
Appender<ILoggingEvent> appender = builder.build(context, encoder);
assertEquals(NAME, builder.getName());
assertTrue(appender instanceof ConsoleAppender);
assertEquals(encoder, ((ConsoleAppender<ILoggingEvent>) appender).getEncoder());
assertNotNull(appender);
assertEquals(NAME, appender.getName());
assertEquals(2, appender.getCopyOfAttachedFiltersList().size());
Filter<ILoggingEvent> filter = appender.getCopyOfAttachedFiltersList().get(0);
assertTrue(filter instanceof MinMaxFilter);
assertEquals(Level.INFO, ((MinMaxFilter) filter).getMin());
assertEquals(Level.ERROR, ((MinMaxFilter) filter).getMax());
filter = appender.getCopyOfAttachedFiltersList().get(1);
assertTrue(filter instanceof MinMaxFilter);
assertEquals(Level.INFO, ((MinMaxFilter) filter).getMin());
assertEquals(Level.WARN, ((MinMaxFilter) filter).getMax());
// TODO: Test that both filters are being applied
}
代码示例来源:origin: dstl/baleen
/** Test abstract functions (using console implementation) and the functions of console */
@Test
public void testAbstractAndConsole() {
BaleenConsoleLoggerBuilder builder =
new BaleenConsoleLoggerBuilder(
NAME, BaleenLogging.DEFAULT_PATTERN, new MinMaxFilter(Level.INFO, Level.WARN));
LoggerContext context = new LoggerContext();
Encoder<ILoggingEvent> encoder = new PatternLayoutEncoder();
Appender<ILoggingEvent> appender = builder.build(context, encoder);
assertEquals(NAME, builder.getName());
assertTrue(appender instanceof ConsoleAppender);
assertEquals(encoder, ((ConsoleAppender<ILoggingEvent>) appender).getEncoder());
assertNotNull(appender);
assertEquals(NAME, appender.getName());
Filter<ILoggingEvent> filter = appender.getCopyOfAttachedFiltersList().get(0);
assertTrue(filter instanceof MinMaxFilter);
assertEquals(Level.INFO, ((MinMaxFilter) filter).getMin());
assertEquals(Level.WARN, ((MinMaxFilter) filter).getMax());
}
内容来源于网络,如有侵权,请联系作者删除!