Details
-
New Feature
-
Resolution: Unresolved
-
Major
-
None
-
1.0.0
-
None
Description
From a user's perspective, it doesn't a bit overkill to copy paste all this stuff:
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
try {
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(context);
// Call context.reset() to clear any previous configuration, e.g. default
// configuration. For multi-step configuration, omit calling context.reset().
context.reset();
configurator.doConfigure(getClass.getResource("/com/domain/project/logback.xml"));
} catch (JoranException je) {
// StatusPrinter will handle this
}
StatusPrinter.printInCaseOfErrorsOrWarnings(context);
It would be nicer if we had a simple static facade method, on JoranConfigurator or LoggerContext, that does all that stuff:
JoranConfigurator.configure(getClass.getResource("/com/domain/project/logback.xml"));
We shouldn't need to understand the internals and the lifecycle of the JoranConfigurator.