当前位置: 首页>>代码示例>>Java>>正文


Java LogFactory类代码示例

本文整理汇总了Java中liquibase.logging.LogFactory的典型用法代码示例。如果您正苦于以下问题:Java LogFactory类的具体用法?Java LogFactory怎么用?Java LogFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LogFactory类属于liquibase.logging包,在下文中一共展示了LogFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLiquibase

import liquibase.logging.LogFactory; //导入依赖的package包/类
private Liquibase getLiquibase(Connection connection) throws Exception {
    ServiceLocator sl = ServiceLocator.getInstance();
    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");
    }
    LogFactory.setInstance(new LogWrapper());
    Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connection));
    return new Liquibase(CHANGELOG, new ClassLoaderResourceAccessor(getClass().getClassLoader()), database);
}
 
开发者ID:Blazebit,项目名称:blaze-storage,代码行数:20,代码来源:LiquibaseUpdater.java

示例2: close

import liquibase.logging.LogFactory; //导入依赖的package包/类
@Override
public void close() throws DatabaseException {

    // copy-paste from AbstractJdbcDatabase plus reflection to deal with private fields...

    ExecutorService.getInstance().clearExecutor(this);
    DatabaseConnection connection = getConnection();
    if (connection != null) {

        Boolean previousAutoCommit = previousAutoCommit();
        if (previousAutoCommit != null) {
            try {
                connection.setAutoCommit(previousAutoCommit);
            } catch (DatabaseException e) {
                LogFactory.getInstance().getLog().warning("Failed to restore the auto commit to " + previousAutoCommit);
                throw e;
            }
        }
        connection.close();
    }
}
 
开发者ID:bootique,项目名称:bootique-liquibase,代码行数:22,代码来源:DerbyDatabase.java

示例3: generateSql

import liquibase.logging.LogFactory; //导入依赖的package包/类
public Sql[] generateSql(DropTableStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
    StringBuffer buffer = new StringBuffer();
    buffer.append("DROP TABLE ").append(database.escapeTableName(statement.getSchemaName(), statement.getTableName()));
    if (statement.isCascadeConstraints()) {
        if (!database.supportsDropTableCascadeConstraints()) {
            LogFactory.getLogger().warning("Database does not support drop with cascade");
        } else if (database instanceof OracleDatabase) {
            buffer.append(" CASCADE CONSTRAINTS");
        } else {
            buffer.append(" CASCADE");
        }
    }

    return new Sql[]{
            new UnparsedSql(buffer.toString())
    };
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:18,代码来源:DropTableGenerator.java

示例4: setConnection

import liquibase.logging.LogFactory; //导入依赖的package包/类
@Override
public void setConnection(DatabaseConnection conn) {
    try {
    	Method wrappedConn = conn.getClass().getMethod("getWrappedConnection");
    	wrappedConn.setAccessible(true);
    	Connection sqlConn = (Connection)wrappedConn.invoke(conn);
        Method method = sqlConn.getClass().getMethod("setRemarksReporting", Boolean.TYPE);
        method.setAccessible(true);
        method.invoke(sqlConn, true);

        reservedWords.addAll(Arrays.asList(sqlConn.getMetaData().getSQLKeywords().toUpperCase().split(",\\s*")));
        reservedWords.addAll(Arrays.asList("USER", "SESSION","RESOURCE")); //more reserved words not returned by driver
    } catch (Exception e) {
        LogFactory.getLogger().info("Could not set remarks reporting on OracleDatabase: "+e.getMessage());
        ; //cannot set it. That is OK
    }
    super.setConnection(conn);
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:19,代码来源:OracleDatabase.java

示例5: validate

import liquibase.logging.LogFactory; //导入依赖的package包/类
public void validate(Database database, String... contexts) throws LiquibaseException {

        ChangeLogIterator logIterator = new ChangeLogIterator(this, new DbmsChangeSetFilter(database), new ContextChangeSetFilter(contexts));

        ValidatingVisitor validatingVisitor = new ValidatingVisitor(database.getRanChangeSetList());
        validatingVisitor.validate(database, this);
        logIterator.run(validatingVisitor, database);

        for (String message : validatingVisitor.getWarnings().getMessages()) {
            LogFactory.getLogger().warning(message);
        }
        
        if (!validatingVisitor.validationPassed()) {
            throw new ValidationFailedException(validatingVisitor);
        }
    }
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:17,代码来源:DatabaseChangeLog.java

示例6: computeMD5

import liquibase.logging.LogFactory; //导入依赖的package包/类
public static String computeMD5(String input) {
    if (input == null) {
        return null;
    }
    MessageDigest digest;
    try {
        digest = MessageDigest.getInstance("MD5");
        digest.update(input.getBytes("UTF-8"));
    } catch (Exception e) {
        throw new UnexpectedLiquibaseException(e);
    }
    byte[] digestBytes = digest.digest();

    String returnString = new String(encodeHex(digestBytes));
    LogFactory.getLogger().debug("Computed checksum for "+input+" as "+returnString);
    return returnString;

}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:19,代码来源:MD5Util.java

示例7: init

import liquibase.logging.LogFactory; //导入依赖的package包/类
@Override
public void init() throws SetupException {
    if (path == null) {
        throw new SetupException("<sqlfile> - No path specified");
    }
    LogFactory.getLogger().debug("SQLFile file:" + path);
    boolean loaded = loadFromClasspath(path);
    if (!loaded) {
        loaded = loadFromFileSystem(path);
    }

    if (!loaded) {
        throw new SetupException("<sqlfile path=" + path + "> - Could not find file");
    }
    LogFactory.getLogger().debug("SQLFile file contents is:" + getSql());
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:17,代码来源:SQLFileChange.java

示例8: validate

import liquibase.logging.LogFactory; //导入依赖的package包/类
public ValidationErrors validate(Database database) {
    ValidationErrors changeValidationErrors = new ValidationErrors();
    for (SqlStatement statement : generateStatements(database)) {
        boolean supported = SqlGeneratorFactory.getInstance().supports(statement, database);
        if (!supported) {
            if (statement.skipOnUnsupported()) {
                LogFactory.getLogger().info(getChangeMetaData().getName()+" is not supported on "+database.getTypeName()+" but will continue");
            } else {
                changeValidationErrors.addError(getChangeMetaData().getName()+" is not supported on "+database.getTypeName());
            }
        } else {
            changeValidationErrors.addAll(SqlGeneratorFactory.getInstance().validate(statement, database));
        }
    }

    return changeValidationErrors;
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:18,代码来源:AbstractChange.java

示例9: generateSql

import liquibase.logging.LogFactory; //导入依赖的package包/类
public Sql[] generateSql(final CreateIndexStatement statement, final Database database, final SqlGeneratorChain sqlGeneratorChain) {
	final Sql[] superSql = super.generateSql(statement, database, sqlGeneratorChain);

	if (statement instanceof CreateIndexWithWhereStatement) {
		if (superSql.length != 1) {
			LogFactory.getLogger().warning("expected 1 create index statement, but got " + superSql.length);
        	return superSql;
		}
		
		return new Sql[] {
				new UnparsedSql(superSql[0].toSql() + " WHERE " + ((CreateIndexWithWhereStatement)statement).getWhere(),
						superSql[0].getEndDelimiter(), superSql[0].getAffectedDatabaseObjects().toArray(new DatabaseObject[0]))
		};
	} else {
		return superSql;
	}
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:18,代码来源:CreateIndexWithWhereGenerator.java

示例10: performDatabaseSetupOrClean

import liquibase.logging.LogFactory; //导入依赖的package包/类
private void performDatabaseSetupOrClean(boolean setup) {
    try {
        ResourceAccessor resourceAccessor = new FileSystemResourceAccessor();
        Class.forName(getJdbcDriverClassname());

        Connection holdingConnection = DriverManager.getConnection(getJdbcConnectionString(), getDbUsername(), getDbPassword());
        HsqlConnection hsconn = new HsqlConnection(holdingConnection);
        LogFactory.getLogger().setLogLevel("warning");
        Liquibase liquibase = new Liquibase(CHANGE_LOG, resourceAccessor, hsconn);
        liquibase.dropAll();
        if (setup) {
            liquibase.update("test");

            liquibase = new Liquibase(TEST_DATA_CHANGE_LOG, resourceAccessor, hsconn);
            liquibase.update("test");
        }

        hsconn.close();
    } catch (Exception ex) {
        String msg = setup ? "Error during database initialization" : "Error during database clean-up";
        LOG.error(msg, ex);
        throw new RuntimeException(msg, ex);
    }
}
 
开发者ID:Multifarious,项目名称:shiro-jdbi-realm,代码行数:25,代码来源:DatabaseUtils.java

示例11: AbstractIntegrationTest

import liquibase.logging.LogFactory; //导入依赖的package包/类
protected AbstractIntegrationTest(String changelogDir, String url) throws Exception {
    LogFactory.setLoggingLevel("info");

    this.completeChangeLog = "changelogs/" + changelogDir + "/complete/root.changelog.xml";
    this.rollbackChangeLog = "changelogs/" + changelogDir + "/rollback/rollbackable.changelog.xml";
    this.includedChangeLog = "changelogs/" + changelogDir + "/complete/included.changelog.xml";
    this.encodingChangeLog = "changelogs/common/encoding.changelog.xml";
    this.externalfkInitChangeLog= "changelogs/common/externalfk.init.changelog.xml";
    this.externalEntityChangeLog= "changelogs/common/externalEntity.changelog.xml";
    this.externalEntityChangeLog2= "com/example/nonIncluded/externalEntity.changelog.xml";
    this.invalidReferenceChangeLog= "changelogs/common/invalid.reference.changelog.xml";
    this.objectQuotingStrategyChangeLog = "changelogs/common/object.quoting.strategy.changelog.xml";

    this.url = url;

    ServiceLocator.getInstance().setResourceAccessor(TestContext.getInstance().getTestResourceAccessor());
}
 
开发者ID:lbitonti,项目名称:liquibase-hana,代码行数:18,代码来源:AbstractIntegrationTest.java

示例12: changeLogLevel

import liquibase.logging.LogFactory; //导入依赖的package包/类
public void changeLogLevel(String logLevel, String logFile) throws CommandLineParsingException {
    ParamUtil.requireNonNull("logLevel", logLevel);
    try {
        Logger log = LogFactory.getInstance().getLog();
        if (logFile != null && logFile.length() > 0) {
            log.setLogLevel(logLevel, logFile);
        } else {
            log.setLogLevel(logLevel);
        }
    } catch (IllegalArgumentException ex) {
        throw new CommandLineParsingException(ex.getMessage(), ex);
    }
}
 
开发者ID:xipki,项目名称:xitk,代码行数:14,代码来源:LiquibaseMain.java

示例13: shutdown

import liquibase.logging.LogFactory; //导入依赖的package包/类
public void shutdown() {
    try {
        if (database != null) {
            database.rollback();
            database.close();
        }
    } catch (DatabaseException ex) {
        LogFactory.getInstance().getLog().warning("problem closing connection", ex);
    } finally {
        database = null;
        liquibase = null;
    }
}
 
开发者ID:xipki,项目名称:xitk,代码行数:14,代码来源:LiquibaseMain.java

示例14: setupLogging

import liquibase.logging.LogFactory; //导入依赖的package包/类
protected void setupLogging() {
    LogFactory.setInstance(new LogFactory() {
        @Override
        public liquibase.logging.Logger getLog(String name) {
            return loggerAdapter;
        }
    });
}
 
开发者ID:bootique,项目名称:bootique-liquibase,代码行数:9,代码来源:LiquibaseRunner.java

示例15: getConnectionCatalogName

import liquibase.logging.LogFactory; //导入依赖的package包/类
@Override
protected String getConnectionCatalogName() throws DatabaseException {
    try {
        return ExecutorService.getInstance().getExecutor(this).queryForObject(new RawSqlStatement("select current schema from sysibm.sysdummy1"), String.class);
    } catch (Exception e) {
        LogFactory.getLogger().info("Error getting default schema", e);
    }
    return null;
}
 
开发者ID:liquibase,项目名称:liquibase-sqlfire,代码行数:10,代码来源:SQLFireDatabase.java


注:本文中的liquibase.logging.LogFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。