Logback + SJ4J使用程式reinitial loback xml

摘要:Logback + SJ4J使用程式reinitial loback xml

http://www.programcreek.com/java-api-examples/index.php?api=ch.qos.logback.classic.joran.JoranConfigurator

 

final URL url = getClass().getClassLoader().getResource("logback-loggly.xml");
    try
    {
        this.context.reset();
        final JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext(this.context);
        configurator.doConfigure(new File(url.getFile()));
    }
    catch(final JoranException e)
    {
        e.printStackTrace();
        fail(e.getMessage());
    }