Java 类ch.qos.logback.classic.filter.LevelFilter 实例源码

项目:hobson-hub-core    文件:OSGIHubManager.java   
@Override
public void addErrorLogAppender(Object aAppender) {
    Appender appender = (Appender)aAppender;

    LevelFilter filter = new LevelFilter();
    filter.setContext((LoggerContext) LoggerFactory.getILoggerFactory());
    filter.setLevel(Level.ERROR);
    filter.setOnMatch(FilterReply.ACCEPT);
    filter.setOnMismatch(FilterReply.DENY);
    filter.start();
    appender.addFilter(filter);

    appender.setContext((LoggerContext) LoggerFactory.getILoggerFactory());
    appender.start();

    ((Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)).addAppender(appender);
}
项目:instalint    文件:SonarLintLogging.java   
private static void init() {
  ConsoleAppender<ILoggingEvent> defaultAppender = new ConsoleAppender<>();
  defaultAppender.setContext((LoggerContext) LoggerFactory.getILoggerFactory());
  defaultAppender.setName(DEFAULT_APPENDER_NAME);
  LevelFilter levelFilter = new LevelFilter();
  levelFilter.setLevel(Level.ERROR);
  defaultAppender.addFilter(levelFilter);

  // if output is not set for thread, keep default behavior (configured to stdout)
  setCustomRootAppender(defaultAppender);
}