Call LoggerContext.reset() during logback init

Update `LogbackLoggingSystem` to call the `reset()` method on the
`LoggerContext` before initialization.

This will hopefully reset the context to prevent the same appenders
from being accidentally added more than once.

Fixes gh-1091
This commit is contained in:
Phillip Webb 2014-09-17 18:00:41 -07:00
parent 6dcaec2fef
commit bebcd60b7c
1 changed files with 1 additions and 0 deletions

View File

@ -96,6 +96,7 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem {
+ "or the competing implementation (" + factory.getClass() + ")"); + "or the competing implementation (" + factory.getClass() + ")");
LoggerContext context = (LoggerContext) factory; LoggerContext context = (LoggerContext) factory;
context.stop(); context.stop();
context.reset();
try { try {
URL url = ResourceUtils.getURL(resolvedLocation); URL url = ResourceUtils.getURL(resolvedLocation);
new ContextInitializer(context).configureByResource(url); new ContextInitializer(context).configureByResource(url);