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
pull/3618/head
Andy Wilkinson 9 years ago
parent 3298761437
commit 255764f1a0

@ -105,7 +105,7 @@
<json-path.version>2.0.0</json-path.version> <json-path.version>2.0.0</json-path.version>
<jstl.version>1.2</jstl.version> <jstl.version>1.2</jstl.version>
<junit.version>4.12</junit.version> <junit.version>4.12</junit.version>
<liquibase.version>3.4.0</liquibase.version> <liquibase.version>3.4.1</liquibase.version>
<log4j.version>1.2.17</log4j.version> <log4j.version>1.2.17</log4j.version>
<log4j2.version>2.3</log4j2.version> <log4j2.version>2.3</log4j2.version>
<logback.version>1.1.3</logback.version> <logback.version>1.1.3</logback.version>

@ -51,6 +51,8 @@ public class LiquibaseServiceLocatorApplicationListener implements
private static class LiquibasePresent { private static class LiquibasePresent {
public void replaceServiceLocator() { public void replaceServiceLocator() {
ServiceLocator.getInstance().addPackageToScan(
CommonsLoggingLiquibaseLogger.class.getPackage().getName());
ServiceLocator.setInstance(new CustomResolverServiceLocator( ServiceLocator.setInstance(new CustomResolverServiceLocator(
new SpringPackageScanClassResolver(logger))); new SpringPackageScanClassResolver(logger)));
} }

Loading…
Cancel
Save