View Javadoc
1   package ch.qos.logback.classic.issue.logback_1162;
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   import ch.qos.logback.core.joran.spi.JoranException;
10  
11  import java.util.concurrent.TimeUnit;
12  
13  public class Main {
14      private static final Logger logger = LoggerFactory.getLogger(Main.class);
15  
16      public static void main(String[] args) throws InterruptedException, JoranException {
17          LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
18          lc.reset();
19          lc.putProperty("output_dir", ClassicTestConstants.OUTPUT_DIR_PREFIX + "logback_issue_1162/");
20  
21          JoranConfigurator configurator = new JoranConfigurator();
22          configurator.setContext(lc);
23          configurator.doConfigure(ClassicTestConstants.JORAN_INPUT_PREFIX + "issues/logback_1162.xml");
24  
25          logger.info("Hello, world!");
26  
27          TimeUnit.SECONDS.sleep(0);
28      }
29  }