package com.test.logging.logback;

import org.junit.After;
import org.junit.Before;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ch.qos.logback.classic.LoggerContext;

import com.test.logging.common.LoggingTest;
import com.test.logging.common.ProfilerOptions;
import com.test.logging.common.TestFactoryType;

/** Logback logger test */
public class LogbackTest {

    /** Profiler options */
    private static final ProfilerOptions opts = new ProfilerOptions("Logback Profiler");

    /** Different types of tests */
    private static final TestFactoryType[] allTypes = TestFactory.getSupportedTypes();

    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
    }

    @AfterClass
    public static void tearDownAfterClass() throws Exception {
        // Stopping the logger context to force flushing the log events
        LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
        loggerContext.stop();
    }

    @Before
    public void setUp() throws Exception {
    }

    @After
    public void tearDown() throws Exception {
    }

    @Test
    public void testSyncFileLogger() {
        // Synchronous file logger
        System.out.println("(((((((((((((   SYNC FILE LOGGER   ))))))))))))))))");
        Logger logger = LoggerFactory.getLogger("SyncFileLogger");
        // Iterate through all unit work types and execute test scenarios
        for (TestFactoryType t : allTypes) {
            new LoggingTest<Logger>(t.toString() + "-Sync", new TestFactory(t, logger), opts).run();
        }
    }

    @Test
    public void testAsyncFileLogger() {
        // Asynchronous file logger
        System.out.println("(((((((((((((   ASYNC FILE LOGGER   ))))))))))))))))");
        Logger asyncLogger = LoggerFactory.getLogger("AsyncFileLogger");
        // Iterate through all unit work types and execute test scenarios
        for (TestFactoryType t : allTypes) {
            new LoggingTest<Logger>(t.toString() + "-Async", new TestFactory(t, asyncLogger), opts).run();
        }
        // Wait for 20 seconds for I/O to catch up and closing of async appenders
        System.out.println("Waiting for 20 seconds for I/O to catch up and proper closing of async appenders.");
        try {
            Thread.sleep(20000);
        } catch (InterruptedException ie) {
            System.err.println("Interrupted while waiting for I/O to catch up.");
        }
    }

}

@@ -417,16 +417,79 @@
 ryType;%0D
+%0Aimport static com.test.logging.common.Util.sleepForIOCatchup;%0D
 %0A%0D%0A/** L
@@ -2270,391 +2270,38 @@
  %7D%0D%0A
-        // Wait for 20 seconds for I/O to catch up and closing of async appenders%0D%0A        System.out.println(%22Waiting for 20 seconds for I/O to catch up and proper closing of async appenders.%22);%0D%0A        try %7B%0D%0A            Thread.sleep(20000);%0D%0A        %7D catch (InterruptedException ie) %7B%0D%0A            System.err.println(%22Interrupted while waiting for I/O to c
+%0D%0A        sleepForIOC
 atch
- 
 up
-.%22);%0D%0A        %7D
+();
 %0D%0A  

Use sleep method in common.Util for logback test.