@Test public void testSimpleAppender() throws JoranException { LoggerContext context = new LoggerContext(); URL resource = getClass().getResource("/logback-with-composite-appender.xml"); JoranConfigurator configurator = new JoranConfigurator(); configurator.setContext(context); configurator.doConfigure(resource); ch.qos.logback.classic.Logger logger = context.getLogger(Logger.ROOT_LOGGER_NAME); CompositeAppender<ILoggingEvent> composite = (CompositeAppender<ILoggingEvent>) logger.getAppender("CONSOLE_AND_FILE"); ListAppender<ILoggingEvent> file = (ListAppender<ILoggingEvent>) composite.getAppender("FILE"); ListAppender<ILoggingEvent> console = (ListAppender<ILoggingEvent>) composite.getAppender("CONSOLE"); logger.info("hello world"); assertThat(file.list.get(0).getMessage()).isEqualTo("hello world"); assertThat(console.list.get(0).getMessage()).isEqualTo("hello world"); }
public Appender<E> getAppender(String name) { return aai.getAppender(name); }
CompositeAppender extends UnsynchronizedAppenderBase<E> implements AppenderAttachable<E> { public Appender<E> getAppender(String name) { return aai.getAppender(name); } }
CompositeAppender extends UnsynchronizedAppenderBase<E> implements AppenderAttachable<E> { public Appender<E> getAppender(String name) { return aai.getAppender(name); }  }
CompositeAppender extends UnsynchronizedAppenderBase<E> implements AppenderAttachable<E> { public Appender<E> getAppender(String name) { return aai.getAppender(name); }  void addAppender(Appender<E> newAppender); Iterator<Appender<E>> iteratorForAppenders(); Appender<E> getAppender(String name); boolean isAttached(Appender<E> eAppender); void detachAndStopAllAppenders(); boolean detachAppender(Appender<E> eAppender); boolean detachAppender(String name); }
CompositeAppender extends UnsynchronizedAppenderBase<E> implements AppenderAttachable<E> { public Appender<E> getAppender(String name) { return aai.getAppender(name); }  void addAppender(Appender<E> newAppender); Iterator<Appender<E>> iteratorForAppenders(); Appender<E> getAppender(String name); boolean isAttached(Appender<E> eAppender); void detachAndStopAllAppenders(); boolean detachAppender(Appender<E> eAppender); boolean detachAppender(String name);  }