@Test public void testConsoleLoggerEnablementForMultipleThread() throws InterruptedException { final CountDownLatch latch1 = new CountDownLatch(1); final CountDownLatch latch2 = new CountDownLatch(1); final LogEnablementRunnable runnable1 = new LogEnablementRunnable(latch1); final LogEnablementRunnable runnable2 = new LogEnablementRunnable(latch2); final LoggerEnablement enablement = JUnitLoggerProvider.getConsoleLoggerEnablement(); enablement.setTraceEnabled(true); new Thread(runnable1).start(); latch1.await(); final LoggerEnablement enablement1 = runnable1.enablement; Assert.assertNotSame(enablement, enablement1); new Thread(runnable2).start(); latch2.await(); final LoggerEnablement enablement2 = runnable2.enablement; Assert.assertNotSame(enablement, enablement2); Assert.assertNotSame(enablement1, enablement2); Assert.assertTrue(enablement.isTraceEnabled()); Assert.assertFalse(enablement1.isTraceEnabled()); Assert.assertFalse(enablement2.isTraceEnabled()); enablement.setTraceEnabled(false); enablement1.setTraceEnabled(true); enablement2.setTraceEnabled(true); Assert.assertFalse(enablement.isTraceEnabled()); Assert.assertTrue(enablement1.isTraceEnabled()); Assert.assertTrue(enablement2.isTraceEnabled()); }
public static LoggerEnablement getConsoleLoggerEnablement() { return getInstance().consoleLoggerEnablement.getLoggerEnablementForThread(); }
JUnitLoggerProvider implements ILoggerProvider { public static LoggerEnablement getConsoleLoggerEnablement() { return getInstance().consoleLoggerEnablement.getLoggerEnablementForThread(); } }
JUnitLoggerProvider implements ILoggerProvider { public static LoggerEnablement getConsoleLoggerEnablement() { return getInstance().consoleLoggerEnablement.getLoggerEnablementForThread(); } private  JUnitLoggerProvider(); }
JUnitLoggerProvider implements ILoggerProvider { public static LoggerEnablement getConsoleLoggerEnablement() { return getInstance().consoleLoggerEnablement.getLoggerEnablementForThread(); } private  JUnitLoggerProvider(); @Override JUnitLoggerComposite get(final String name, final String wrapperFQCN); static void reset(); static JUnitLogger getGlobalLogger(); @SuppressWarnings("unchecked") static JUnitLogger getLogger(final String name, final String wrapperFQCN); static JUnitLogger getLogger(final Class<?> clazz); static LoggerEnablement getConsoleLoggerEnablement(); static JUnitLoggerComposite getLoggerComposite(final String name, final String wrapperFQCN); }
JUnitLoggerProvider implements ILoggerProvider { public static LoggerEnablement getConsoleLoggerEnablement() { return getInstance().consoleLoggerEnablement.getLoggerEnablementForThread(); } private  JUnitLoggerProvider(); @Override JUnitLoggerComposite get(final String name, final String wrapperFQCN); static void reset(); static JUnitLogger getGlobalLogger(); @SuppressWarnings("unchecked") static JUnitLogger getLogger(final String name, final String wrapperFQCN); static JUnitLogger getLogger(final Class<?> clazz); static LoggerEnablement getConsoleLoggerEnablement(); static JUnitLoggerComposite getLoggerComposite(final String name, final String wrapperFQCN);  }