### Question:
LogAppenderInitializer implements Closeable { public void initialize() { initialize(Logger.ROOT_LOGGER_NAME); } @Inject  LogAppenderInitializer(LogAppender logAppender); void initialize(); @VisibleForTesting synchronized void initialize(String loggerName); void setLogLevels(Map<String, Level> logPairs); @Override synchronized void close();  }### Answer:
@Test (timeout = 10000L) public void testConfigUpdate() throws Exception { File logbackFile = createLogbackFile(new File(TEMP_FOLDER.newFolder(), "logback.xml"), ""); LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); loggerContext.reset(); JoranConfigurator configurator = new JoranConfigurator(); configurator.setContext(loggerContext); configurator.doConfigure(logbackFile); TestLogAppender testAppender = new TestLogAppender(); testAppender.setName("TestAppender"); LogAppenderInitializer initializer = new LogAppenderInitializer(testAppender); initializer.initialize(); LoggingContextAccessor.setLoggingContext(new TestLoggingContext("ns", "app", "run", "instance")); Logger logger = loggerContext.getLogger(LogAppenderInitializerTest.class); logger.info("Testing"); Assert.assertEquals("Testing", testAppender.getLastMessage()); createLogbackFile(logbackFile, "<logger name=\"io.cdap.cdap\" level=\"INFO\" />"); while (!testAppender.isStoppedOnce()) { logger.info("Waiting stop"); TimeUnit.MILLISECONDS.sleep(150); logbackFile.setLastModified(System.currentTimeMillis()); } Tasks.waitFor(true, testAppender::isStarted, 5, TimeUnit.SECONDS); logger.info("Reattached"); Assert.assertEquals("Reattached", testAppender.getLastMessage()); loggerContext.stop(); }