Details
-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
None
Description
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);