1   package ch.qos.logback.classic.issue.logback_1361;
2   
3   import org.slf4j.Logger;
4   import org.slf4j.LoggerFactory;
5   
6   import ch.qos.logback.classic.ClassicTestConstants;
7   import ch.qos.logback.classic.LoggerContext;
8   import ch.qos.logback.classic.joran.JoranConfigurator;
9   
10  public class Main {
11      private static Logger logger = LoggerFactory.getLogger(Main.class);
12  
13      private static String ONE_KB_STRING;
14  
15      public static void main(String[] args) throws Exception {
16          LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
17          lc.reset();
18          lc.putProperty("output_dir", ClassicTestConstants.OUTPUT_DIR_PREFIX + "logback_issue_1361/");
19  
20          JoranConfigurator configurator = new JoranConfigurator();
21          configurator.setContext(lc);
22          configurator.doConfigure(ClassicTestConstants.INPUT_PREFIX + "issue/logback_1361.xml");
23  
24          log1MegaByteInOneSecond();
25      }
26  
27      static {
28          StringBuilder sb = new StringBuilder();
29          for (int j = 0; j < 100; j++) {
30              String message = "1234567890";
31              sb.append(message);
32          }
33          ONE_KB_STRING = sb.toString();
34      }
35  
36      private static void log1MegaByteInOneSecond() throws Exception {
37          for (int i = 0; i < 1000; i++) {
38              logger.warn(i + " - " + ONE_KB_STRING);
39              Thread.sleep(1);
40          }
41      }
42  
43  }