@Test public void testWithDevelopmentEnvironment() throws JoranException { LoggerContext context = new LoggerContext(); URL resource = getClass().getResource("/logback-with-select-appender.xml"); JoranConfigurator configurator = new JoranConfigurator(); context.putProperty("APPENDER_KEY", "development"); configurator.setContext(context); configurator.doConfigure(resource); ch.qos.logback.classic.Logger logger = context.getLogger(Logger.ROOT_LOGGER_NAME); SelectAppender selectAppender = (SelectAppender) logger.getAppender("SELECT"); CompositeAppender<ILoggingEvent> development = (CompositeAppender<ILoggingEvent>) selectAppender.getAppender("test"); ListAppender<ILoggingEvent> listAppender = (ListAppender<ILoggingEvent>) development.getAppender("test-list"); logger.info("hello world"); assertThat(listAppender.list.size()).isEqualTo(0); }
@Override public Appender<E> getAppender(String name) { return aai.getAppender(name); }
SelectAppender extends AppenderBase<E> implements AppenderAttachable<E> { @Override public Appender<E> getAppender(String name) { return aai.getAppender(name); } }
SelectAppender extends AppenderBase<E> implements AppenderAttachable<E> { @Override public Appender<E> getAppender(String name) { return aai.getAppender(name); }  }
SelectAppender extends AppenderBase<E> implements AppenderAttachable<E> { @Override public Appender<E> getAppender(String name) { return aai.getAppender(name); }  @Override void start(); @Override void stop(); @Override boolean isStarted(); String getAppenderKey(); void setAppenderKey(String appenderKey); @Override void addAppender(Appender<E> newAppender); @Override Iterator<Appender<E>> iteratorForAppenders(); @Override Appender<E> getAppender(String name); @Override boolean isAttached(Appender<E> appender); @Override void detachAndStopAllAppenders(); @Override boolean detachAppender(Appender<E> appender); @Override boolean detachAppender(String name); }
SelectAppender extends AppenderBase<E> implements AppenderAttachable<E> { @Override public Appender<E> getAppender(String name) { return aai.getAppender(name); }  @Override void start(); @Override void stop(); @Override boolean isStarted(); String getAppenderKey(); void setAppenderKey(String appenderKey); @Override void addAppender(Appender<E> newAppender); @Override Iterator<Appender<E>> iteratorForAppenders(); @Override Appender<E> getAppender(String name); @Override boolean isAttached(Appender<E> appender); @Override void detachAndStopAllAppenders(); @Override boolean detachAppender(Appender<E> appender); @Override boolean detachAppender(String name);  }