liquibase.logging.LogFactory Java Examples

The following examples show how to use liquibase.logging.LogFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KeycloakRecorder.java    From keycloak with Apache License 2.0 6 votes vote down vote up
public void configureLiquibase(Map<String, List<String>> services) {
    LogFactory.setInstance(new LogFactory() {
        KeycloakLogger logger = new KeycloakLogger();

        @Override
        public liquibase.logging.Logger getLog(String name) {
            return logger;
        }

        @Override
        public liquibase.logging.Logger getLog() {
            return logger;
        }
    });
    
    // we set this property to avoid Liquibase to lookup resources from the classpath and access JAR files
    // we already index the packages we want so Liquibase will still be able to load these services
    // for uber-jar, this is not a problem because everything is inside the JAR, but once we move to fast-jar we'll have performance penalties
    // it seems that v4 of liquibase provides a more smart way of initialization the ServiceLocator that may allow us to remove this
    System.setProperty("liquibase.scan.packages", "org.liquibase.core");
    
    ServiceLocator.setInstance(new FastServiceLocator(services));
}
 
Example #2
Source File: LiquibaseIT.java    From liquibase-spatial with Apache License 2.0 4 votes vote down vote up
/**
 * Initialization for each test.
 */
@SuppressWarnings("deprecation")
@BeforeTest
public void setUp() throws Exception {
   LogFactory.setLoggingLevel("debug");
}
 
Example #3
Source File: DefaultLiquibaseConnectionProvider.java    From keycloak with Apache License 2.0 4 votes vote down vote up
protected void baseLiquibaseInitialization() {
    ServiceLocator sl = ServiceLocator.getInstance();
    sl.setResourceAccessor(new ClassLoaderResourceAccessor(getClass().getClassLoader()));

    if (!System.getProperties().containsKey("liquibase.scan.packages")) {
        if (sl.getPackages().remove("liquibase.core")) {
            sl.addPackageToScan("liquibase.core.xml");
        }

        if (sl.getPackages().remove("liquibase.parser")) {
            sl.addPackageToScan("liquibase.parser.core.xml");
        }

        if (sl.getPackages().remove("liquibase.serializer")) {
            sl.addPackageToScan("liquibase.serializer.core.xml");
        }

        sl.getPackages().remove("liquibase.ext");
        sl.getPackages().remove("liquibase.sdk");

        String lockPackageName = DummyLockService.class.getPackage().getName();
        logger.debugf("Added package %s to liquibase", lockPackageName);
        sl.addPackageToScan(lockPackageName);
    }

    LogFactory.setInstance(new LogWrapper());

    // Adding PostgresPlus support to liquibase
    DatabaseFactory.getInstance().register(new PostgresPlusDatabase());
    // Adding newer version of MySQL/MariaDB support to liquibase
    DatabaseFactory.getInstance().register(new UpdatedMySqlDatabase());
    DatabaseFactory.getInstance().register(new UpdatedMariaDBDatabase());

    // Adding CustomVarcharType for MySQL 8 and newer
    DataTypeFactory.getInstance().register(MySQL8VarcharType.class);

    // Change command for creating lock and drop DELETE lock record from it
    SqlGeneratorFactory.getInstance().register(new CustomInsertLockRecordGenerator());

    // Use "SELECT FOR UPDATE" for locking database
    SqlGeneratorFactory.getInstance().register(new CustomLockDatabaseChangeLogGenerator());
}