Browse Source

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
pull/1588/head
Phillip Webb 12 years ago
parent
commit
bebcd60b7c
  1. 1
      spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java

1
spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java

@ -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);

Loading…
Cancel
Save