SeparateTaskLogTaskLogger extends ProgressTaskLogger { @Override public final void finish() { super.finish(); log.info(TASK_LOG_ONLY, "Task complete"); MDC.remove(LOGBACK_TASK_DISCRIMINATOR_ID); MDC.remove(TASK_LOG_ONLY_MDC); MDC.remove(TASK_LOG_WITH_PROGRESS_MDC); } SeparateTaskLogTaskLogger(final Logger log, final TaskLogInfo taskLogInfo); @Override final void start(); @Override final void finish(); @Override void flush();  }
@Test public void testFinishClearsMDCValues() { MDC.put(TASK_LOG_ONLY_MDC, "something"); assertThat(MDC.get(TASK_LOG_ONLY_MDC), notNullValue()); assertThat(MDC.get(LOGBACK_TASK_DISCRIMINATOR_ID), notNullValue()); underTest.finish(); assertThat(MDC.get(TASK_LOG_ONLY_MDC), nullValue()); assertThat(MDC.get(LOGBACK_TASK_DISCRIMINATOR_ID), nullValue()); }