Source:
public void canParseNewLoggerFormat() throws Exception { final DefaultLoggingFactory config = factory.build( new File(Resources.getResource("yaml/logging_advanced.yml").toURI())); assertThat(config.getLoggers()).contains(MapEntry.entry("com.example.app", new TextNode("INFO"))); final JsonNode newApp = config.getLoggers().get("com.example.newApp"); assertThat(newApp).isNotNull(); final LoggerConfiguration newAppConfiguration = objectMapper.treeToValue(newApp, LoggerConfiguration.class); assertThat(newAppConfiguration.getLevel()).isEqualTo(Level.DEBUG); assertThat(newAppConfiguration.getAppenders()).hasSize(1); final AppenderFactory appenderFactory = newAppConfiguration.getAppenders().get(0); assertThat(appenderFactory).isInstanceOf(FileAppenderFactory.class); final FileAppenderFactory fileAppenderFactory = (FileAppenderFactory) appenderFactory; assertThat(fileAppenderFactory.getCurrentLogFilename()).isEqualTo("${new_app}.log"); assertThat(fileAppenderFactory.getArchivedLogFilenamePattern()).isEqualTo("${new_app}-%d.log.gz"); assertThat(fileAppenderFactory.getArchivedFileCount()).isEqualTo(5); assertThat(fileAppenderFactory.getFilterFactories()).containsExactly(new TestFilterFactory(), new SecondTestFilterFactory()); final JsonNode legacyApp = config.getLoggers().get("com.example.legacyApp"); assertThat(legacyApp).isNotNull(); final LoggerConfiguration legacyAppConfiguration = objectMapper.treeToValue(legacyApp, LoggerConfiguration.class); assertThat(legacyAppConfiguration.getLevel()).isEqualTo(Level.DEBUG); assertThat(legacyAppConfiguration.getAppenders()).isEmpty(); }

Target:
public void canParseNewLoggerFormat() throws Exception { final DefaultLoggingFactory config = factory.build( new File(Resources.getResource("yaml/logging_advanced.yml").toURI())); assertThat(config.getLoggers()).contains(MapEntry.entry("com.example.app", new TextNode("INFO"))); final JsonNode newApp = config.getLoggers().get("com.example.newApp"); assertThat(newApp).isNotNull(); final LoggerConfiguration newAppConfiguration = objectMapper.treeToValue(newApp, LoggerConfiguration.class); assertThat(newAppConfiguration.getLevel()).isEqualTo(Level.DEBUG); assertThat(newAppConfiguration.getAppenders()).hasSize(1); final AppenderFactory<ILoggingEvent> appenderFactory = newAppConfiguration.getAppenders().get(0); assertThat(appenderFactory).isInstanceOf(FileAppenderFactory.class); final FileAppenderFactory<ILoggingEvent> fileAppenderFactory = (FileAppenderFactory<ILoggingEvent>) appenderFactory; assertThat(fileAppenderFactory.getCurrentLogFilename()).isEqualTo("${new_app}.log"); assertThat(fileAppenderFactory.getArchivedLogFilenamePattern()).isEqualTo("${new_app}-%d.log.gz"); assertThat(fileAppenderFactory.getArchivedFileCount()).isEqualTo(5); final ImmutableList<FilterFactory<ILoggingEvent>> filterFactories = fileAppenderFactory.getFilterFactories(); assertThat(filterFactories).hasSize(2); assertThat(filterFactories.get(0)).isExactlyInstanceOf(TestFilterFactory.class); assertThat(filterFactories.get(1)).isExactlyInstanceOf(SecondTestFilterFactory.class); final JsonNode legacyApp = config.getLoggers().get("com.example.legacyApp"); assertThat(legacyApp).isNotNull(); final LoggerConfiguration legacyAppConfiguration = objectMapper.treeToValue(legacyApp, LoggerConfiguration.class); assertThat(legacyAppConfiguration.getLevel()).isEqualTo(Level.DEBUG); assertThat(legacyAppConfiguration.getAppenders()).isEmpty(); }