001package ch.qos.logback.classic.issue.logback_1361;
002import org.slf4j.Logger;
003import org.slf4j.LoggerFactory;
004
005import ch.qos.logback.classic.ClassicTestConstants;
006import ch.qos.logback.classic.LoggerContext;
007import ch.qos.logback.classic.joran.JoranConfigurator;
008
009public class Main {
010    private static Logger logger = LoggerFactory.getLogger(Main.class);
011
012    private static String ONE_KB_STRING;
013    
014    public static void main(String[] args) throws Exception {
015        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
016        lc.reset();
017        lc.putProperty("output_dir", ClassicTestConstants.OUTPUT_DIR_PREFIX+"logback_issue_1361/");
018        
019        JoranConfigurator configurator = new JoranConfigurator();
020        configurator.setContext(lc);
021        configurator.doConfigure(ClassicTestConstants.INPUT_PREFIX+ "issue/logback_1361.xml");
022
023        log1MegaByteInOneSecond();
024    }
025    
026    static {
027        StringBuilder sb = new StringBuilder();
028        for (int j = 0; j < 100; j++) {
029            String message = "1234567890";
030            sb.append(message);
031        }
032        ONE_KB_STRING = sb.toString();
033    }
034
035
036    private static void log1MegaByteInOneSecond() throws Exception {
037        for (int i = 0; i < 1000; i++) {
038            logger.warn(i + " - " + ONE_KB_STRING);
039            Thread.sleep(1);
040        }
041    }
042
043
044}