Support loading configuration via classpath
-------------------------------------------

                 Key: LBCORE-249
                 URL: http://jira.qos.ch/browse/LBCORE-249
             Project: logback-core
          Issue Type: Improvement
          Components: Joran
    Affects Versions: unspecified
            Reporter: Alex Glass
            Assignee: Logback dev list
            Priority: Minor


A lot of boilerplate is needed to load a configuration file with Joran.  I 
suggest improving doConfigure to support scanning inputs on the classpath.  
Sample code of 7 lines could be condensed to two.

                LoggerContext context = (LoggerContext) 
LoggerFactory.getILoggerFactory();
                
                JoranConfigurator configurator = new JoranConfigurator();
                configurator.setContext(context);
                context.reset();
                
                InputStream inputStream = 
SmtpTest.class.getClassLoader().getResourceAsStream(INPUT_FILE);
                if(inputStream == null) throw new IllegalStateException("File 
not found: " + INPUT_FILE);
                configurator.doConfigure(inputStream);

VS

                JoranConfigurator configurator = new JoranConfigurator();
                configurator.doConfigure(INPUT_FILE);

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
logback-dev mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-dev

Reply via email to