use of com.kixeye.chassis.support.events.LoggingReloadedApplicationEvent in project chassis by Kixeye.
the class LoggingConfiguration method reloadLogging.
/**
* Reloads logging.
*
* @param logbackConfig XML containing the logback configuration
*/
public void reloadLogging(String logbackConfig) {
LoggerContext logContext = (LoggerContext) LoggerFactory.getILoggerFactory();
try {
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(logContext);
logContext.reset();
configurator.doConfigure(new ByteArrayInputStream(logbackConfig.getBytes(Charsets.UTF_8)));
} catch (JoranException je) {
// StatusPrinter will handle this
} catch (Exception ex) {
// Just in case, so we see a stacktrace
ex.printStackTrace();
}
StatusPrinter.printInCaseOfErrorsOrWarnings(logContext);
applicationContext.publishEvent(new LoggingReloadedApplicationEvent(this));
}
Aggregations