Search in sources :

Example 1 with JoranConfigurator

use of ch.qos.logback.access.joran.JoranConfigurator in project logback-access-spring-boot-starter by akihyro.

the class LogbackAccessContext method configureWithCauseThrowing.

/**
     * Configures by the configuration file.
     * Cause exceptions is not wrapped with {@link LogbackAccessConfigurationException}.
     * If configuration file is absent, throws an exception ({@link FileNotFoundException}).
     *
     * @param config the location of the configuration file.
     * @throws IOException if an I/O exception occurs.
     * @throws JoranException if a {@link JoranConfigurator} exception occurs.
     */
private void configureWithCauseThrowing(String config) throws IOException, JoranException {
    URL url = ResourceUtils.getURL(config);
    @Cleanup InputStream stream = url.openStream();
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(this);
    configurator.doConfigure(stream);
    log.info("Configured the Logback-access: context=[{}], config=[{}]", this, config);
}
Also used : InputStream(java.io.InputStream) JoranConfigurator(ch.qos.logback.access.joran.JoranConfigurator) Cleanup(lombok.Cleanup) URL(java.net.URL)

Aggregations

JoranConfigurator (ch.qos.logback.access.joran.JoranConfigurator)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1 Cleanup (lombok.Cleanup)1