From 255764f1a0080122b15e8be95acae7963d9055cc Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 29 Jul 2015 10:00:06 +0100 Subject: [PATCH] Ensure that custom Liquibase logger is always used Liquibase 3.4.0 contains a bug that causes the initialization of its ServiceLocator to pollute its map of loggers with a DefaultLogger for the logger named "liquibase". Liquibase 3.4.1 contains a change that improves the situation, but does not address is completely. Creating a CustomResolverServiceLocator, as we do, still causes the map of loggers to be polluted due to logging that's performed in ClassLoaderResourceAccessor.getResourcesAsStream. The commit address the problem by upgrading to Liquibase 3.4.1 and adding the package containing our custom logger to the default service locator before we register our custom service locator. This ensures that the logging that's performed during the creation of our custom service locator will still use our custom logger. Closes gh-3470 Closes gh-3616 --- spring-boot-dependencies/pom.xml | 2 +- .../liquibase/LiquibaseServiceLocatorApplicationListener.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml index ad229b71b3..079b682bbe 100644 --- a/spring-boot-dependencies/pom.xml +++ b/spring-boot-dependencies/pom.xml @@ -105,7 +105,7 @@ 2.0.0 1.2 4.12 - 3.4.0 + 3.4.1 1.2.17 2.3 1.1.3 diff --git a/spring-boot/src/main/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListener.java index ace2a49136..47ee4784a0 100644 --- a/spring-boot/src/main/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/liquibase/LiquibaseServiceLocatorApplicationListener.java @@ -51,6 +51,8 @@ public class LiquibaseServiceLocatorApplicationListener implements private static class LiquibasePresent { public void replaceServiceLocator() { + ServiceLocator.getInstance().addPackageToScan( + CommonsLoggingLiquibaseLogger.class.getPackage().getName()); ServiceLocator.setInstance(new CustomResolverServiceLocator( new SpringPackageScanClassResolver(logger))); }