From d1814947b36e2ed7aacf8b76dc0e9492fb3addf5 Mon Sep 17 00:00:00 2001 From: Ken Stevens Date: Thu, 31 Oct 2019 17:12:02 -0400 Subject: [PATCH] include version number in log message --- .../java/ca/uhn/fhir/jpa/migrate/FlywayMigration.java | 3 +-- .../ca/uhn/fhir/jpa/migrate/taskdef/AddColumnTask.java | 4 ++-- .../fhir/jpa/migrate/taskdef/AddForeignKeyTask.java | 2 +- .../fhir/jpa/migrate/taskdef/AddIdGeneratorTask.java | 2 +- .../ca/uhn/fhir/jpa/migrate/taskdef/AddIndexTask.java | 4 ++-- .../fhir/jpa/migrate/taskdef/AddTableByColumnTask.java | 2 +- .../fhir/jpa/migrate/taskdef/AddTableRawSqlTask.java | 4 ++-- .../uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTask.java | 10 +++++----- .../java/ca/uhn/fhir/jpa/migrate/taskdef/BaseTask.java | 6 +++++- .../fhir/jpa/migrate/taskdef/CalculateHashesTask.java | 10 +++++----- .../uhn/fhir/jpa/migrate/taskdef/DropColumnTask.java | 4 ++-- .../fhir/jpa/migrate/taskdef/DropForeignKeyTask.java | 2 +- .../fhir/jpa/migrate/taskdef/DropIdGeneratorTask.java | 2 +- .../ca/uhn/fhir/jpa/migrate/taskdef/DropIndexTask.java | 4 ++-- .../ca/uhn/fhir/jpa/migrate/taskdef/DropTableTask.java | 8 ++++---- .../fhir/jpa/migrate/taskdef/ExecuteRawSqlTask.java | 2 +- .../uhn/fhir/jpa/migrate/taskdef/ModifyColumnTask.java | 8 ++++---- .../uhn/fhir/jpa/migrate/taskdef/RenameColumnTask.java | 6 +++--- 18 files changed, 43 insertions(+), 40 deletions(-) diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/FlywayMigration.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/FlywayMigration.java index 2afbb413bf9..eedb096b29e 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/FlywayMigration.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/FlywayMigration.java @@ -22,8 +22,7 @@ public class FlywayMigration implements JavaMigration { @Override public MigrationVersion getVersion() { - String flywayVersion = myTask.getFlywayVersion(); - return MigrationVersion.fromVersion(flywayVersion); + return MigrationVersion.fromVersion(myTask.getFlywayVersion()); } @Override diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddColumnTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddColumnTask.java index 9b51e2e4743..20f505260e6 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddColumnTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddColumnTask.java @@ -45,7 +45,7 @@ public class AddColumnTask extends BaseTableColumnTypeTask { public void execute() throws SQLException { Set columnNames = JdbcUtils.getColumnNames(getConnectionProperties(), getTableName()); if (columnNames.contains(getColumnName())) { - ourLog.info("Column {} already exists on table {} - No action performed", getColumnName(), getTableName()); + logInfo(ourLog, "Column {} already exists on table {} - No action performed", getColumnName(), getTableName()); return; } @@ -68,7 +68,7 @@ public class AddColumnTask extends BaseTableColumnTypeTask { throw new IllegalStateException(); } - ourLog.info("Adding column {} of type {} to table {}", getColumnName(), getSqlType(), getTableName()); + logInfo(ourLog, "Adding column {} of type {} to table {}", getColumnName(), getSqlType(), getTableName()); executeSql(getTableName(), sql); } diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddForeignKeyTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddForeignKeyTask.java index 3a27124687c..603c262cd17 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddForeignKeyTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddForeignKeyTask.java @@ -69,7 +69,7 @@ public class AddForeignKeyTask extends BaseTableColumnTask { Set existing = JdbcUtils.getForeignKeys(getConnectionProperties(), myForeignTableName, getTableName()); if (existing.contains(myConstraintName)) { - ourLog.info("Already have constraint named {} - No action performed", myConstraintName); + logInfo(ourLog, "Already have constraint named {} - No action performed", myConstraintName); return; } diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIdGeneratorTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIdGeneratorTask.java index ce989f6a7a2..16e8ab8fcea 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIdGeneratorTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIdGeneratorTask.java @@ -90,7 +90,7 @@ public class AddIdGeneratorTask extends BaseTask { .collect(Collectors.toSet()); ourLog.debug("Currently have sequences: {}", sequenceNames); if (sequenceNames.contains(myGeneratorName.toLowerCase())) { - ourLog.info("Sequence {} already exists - No action performed", myGeneratorName); + logInfo(ourLog, "Sequence {} already exists - No action performed", myGeneratorName); return; } diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIndexTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIndexTask.java index bb65fcdcca2..572e878bb6c 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIndexTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddIndexTask.java @@ -69,11 +69,11 @@ public class AddIndexTask extends BaseTableTask { public void execute() throws SQLException { Set indexNames = JdbcUtils.getIndexNames(getConnectionProperties(), getTableName()); if (indexNames.contains(myIndexName)) { - ourLog.info("Index {} already exists on table {} - No action performed", myIndexName, getTableName()); + logInfo(ourLog, "Index {} already exists on table {} - No action performed", myIndexName, getTableName()); return; } - ourLog.info("Going to add a {} index named {} on table {} for columns {}", (myUnique ? "UNIQUE" : "NON-UNIQUE"), myIndexName, getTableName(), myColumns); + logInfo(ourLog, "Going to add a {} index named {} on table {} for columns {}", (myUnique ? "UNIQUE" : "NON-UNIQUE"), myIndexName, getTableName(), myColumns); String unique = myUnique ? "unique " : ""; String columns = String.join(", ", myColumns); diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableByColumnTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableByColumnTask.java index 6a30724b900..0901aa0e22f 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableByColumnTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableByColumnTask.java @@ -55,7 +55,7 @@ public class AddTableByColumnTask extends BaseTableTask { public void execute() throws SQLException { if (JdbcUtils.getTableNames(getConnectionProperties()).contains(getTableName())) { - ourLog.info("Already have table named {} - No action performed", getTableName()); + logInfo(ourLog, "Already have table named {} - No action performed", getTableName()); return; } diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableRawSqlTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableRawSqlTask.java index e5720bc9f0e..aa6f95335a7 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableRawSqlTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/AddTableRawSqlTask.java @@ -55,14 +55,14 @@ public class AddTableRawSqlTask extends BaseTableTask { public void execute() throws SQLException { Set tableNames = JdbcUtils.getTableNames(getConnectionProperties()); if (tableNames.contains(getTableName())) { - ourLog.info("Table {} already exists - No action performed", getTableName()); + logInfo(ourLog, "Table {} already exists - No action performed", getTableName()); return; } List sqlStatements = myDriverToSqls.computeIfAbsent(getDriverType(), t -> new ArrayList<>()); sqlStatements.addAll(myDriverNeutralSqls); - ourLog.info("Going to create table {} using {} SQL statements", getTableName(), sqlStatements.size()); + logInfo(ourLog, "Going to create table {} using {} SQL statements", getTableName(), sqlStatements.size()); getConnectionProperties().getTxTemplate().execute(t -> { JdbcTemplate jdbcTemplate = getConnectionProperties().newJdbcTemplate(); diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTask.java index a71453b98ba..3aeb1a5bffa 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTask.java @@ -62,12 +62,12 @@ public class ArbitrarySqlTask extends BaseTask { @Override public void execute() throws SQLException { - ourLog.info("Starting: {}", myDescription); + logInfo(ourLog, "Starting: {}", myDescription); if (StringUtils.isNotBlank(myExecuteOnlyIfTableExists)) { Set tableNames = JdbcUtils.getTableNames(getConnectionProperties()); if (!tableNames.contains(myExecuteOnlyIfTableExists.toUpperCase())) { - ourLog.info("Table {} does not exist - No action performed", myExecuteOnlyIfTableExists); + logInfo(ourLog, "Table {} does not exist - No action performed", myExecuteOnlyIfTableExists); return; } } @@ -75,7 +75,7 @@ public class ArbitrarySqlTask extends BaseTask { for (TableAndColumn next : myConditionalOnExistenceOf) { JdbcUtils.ColumnType columnType = JdbcUtils.getColumnType(getConnectionProperties(), next.getTable(), next.getColumn()); if (columnType == null) { - ourLog.info("Table {} does not have column {} - No action performed", next.getTable(), next.getColumn()); + logInfo(ourLog, "Table {} does not have column {} - No action performed", next.getTable(), next.getColumn()); return; } } @@ -129,14 +129,14 @@ public class ArbitrarySqlTask extends BaseTask { List> rows; do { - ourLog.info("Querying for up to {} rows", myBatchSize); + logInfo(ourLog, "Querying for up to {} rows", myBatchSize); rows = getTxTemplate().execute(t -> { JdbcTemplate jdbcTemplate = newJdbcTemnplate(); jdbcTemplate.setMaxRows(myBatchSize); return jdbcTemplate.query(mySql, new ColumnMapRowMapper()); }); - ourLog.info("Processing {} rows", rows.size()); + logInfo(ourLog, "Processing {} rows", rows.size()); List> finalRows = rows; getTxTemplate().execute(t -> { for (Map nextRow : finalRows) { diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/BaseTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/BaseTask.java index cd18f042a22..bf2294c5b47 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/BaseTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/BaseTask.java @@ -99,7 +99,7 @@ public abstract class BaseTask { Integer changes = getConnectionProperties().getTxTemplate().execute(t -> { JdbcTemplate jdbcTemplate = getConnectionProperties().newJdbcTemplate(); int changesCount = jdbcTemplate.update(theSql, theArguments); - ourLog.info("SQL \"{}\" returned {}", theSql, changesCount); + logInfo(ourLog, "SQL \"{}\" returned {}", theSql, changesCount); return changesCount; }); @@ -150,6 +150,10 @@ public abstract class BaseTask { return releasePart + "." + myVersion; } + protected void logInfo(Logger theLog, String theFormattedMessage, Object... theArguments) { + theLog.info(getFlywayVersion() + ": " + theFormattedMessage, theArguments); + } + public void validateVersion() { Matcher matcher = versionPattern.matcher(myVersion); if (!matcher.matches()) { diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/CalculateHashesTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/CalculateHashesTask.java index 524b651f0d0..2681498c409 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/CalculateHashesTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/CalculateHashesTask.java @@ -73,7 +73,7 @@ public class CalculateHashesTask extends BaseTableColumnTask next : futures) { try { next.get(); @@ -119,7 +119,7 @@ public class CalculateHashesTask extends BaseTableColumnTask { public void execute() throws SQLException { Set columnNames = JdbcUtils.getColumnNames(getConnectionProperties(), getTableName()); if (!columnNames.contains(getColumnName())) { - ourLog.info("Column {} does not exist on table {} - No action performed", getColumnName(), getTableName()); + logInfo(ourLog, "Column {} does not exist on table {} - No action performed", getColumnName(), getTableName()); return; } String tableName = getTableName(); String columnName = getColumnName(); String sql = createSql(tableName, columnName); - ourLog.info("Dropping column {} on table {}", getColumnName(), getTableName()); + logInfo(ourLog, "Dropping column {} on table {}", getColumnName(), getTableName()); executeSql(getTableName(), sql); } diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTask.java index 3fa35fa4ded..36ae6ccaae3 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTask.java @@ -67,7 +67,7 @@ public class DropForeignKeyTask extends BaseTableTask { Set existing = JdbcUtils.getForeignKeys(getConnectionProperties(), myParentTableName, getTableName()); if (!existing.contains(myConstraintName)) { - ourLog.info("Don't have constraint named {} - No action performed", myConstraintName); + logInfo(ourLog, "Don't have constraint named {} - No action performed", myConstraintName); return; } diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIdGeneratorTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIdGeneratorTask.java index 050f8af8651..7db705f363c 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIdGeneratorTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIdGeneratorTask.java @@ -90,7 +90,7 @@ public class DropIdGeneratorTask extends BaseTask { .collect(Collectors.toSet()); ourLog.debug("Currently have sequences: {}", sequenceNames); if (!sequenceNames.contains(myGeneratorName.toLowerCase())) { - ourLog.info("Sequence {} does not exist - No action performed", myGeneratorName); + logInfo(ourLog, "Sequence {} does not exist - No action performed", myGeneratorName); return; } diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIndexTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIndexTask.java index ffc1ad8b73a..00bf14b90a3 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIndexTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropIndexTask.java @@ -56,7 +56,7 @@ public class DropIndexTask extends BaseTableTask { Set indexNames = JdbcUtils.getIndexNames(getConnectionProperties(), getTableName()); if (!indexNames.contains(myIndexName)) { - ourLog.info("Index {} does not exist on table {} - No action needed", myIndexName, getTableName()); + logInfo(ourLog, "Index {} does not exist on table {} - No action needed", myIndexName, getTableName()); return; } @@ -65,7 +65,7 @@ public class DropIndexTask extends BaseTableTask { Optional sql = createDropIndexSql(getConnectionProperties(), getTableName(), myIndexName, getDriverType()); if (sql.isPresent()) { - ourLog.info("Dropping {} index {} on table {}", uniquenessString, myIndexName, getTableName()); + logInfo(ourLog, "Dropping {} index {} on table {}", uniquenessString, myIndexName, getTableName()); executeSql(getTableName(), sql.get()); } } diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropTableTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropTableTask.java index afc7fc74d20..22e9022f684 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropTableTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropTableTask.java @@ -45,10 +45,10 @@ public class DropTableTask extends BaseTableTask { } Set foreignKeys = JdbcUtils.getForeignKeys(getConnectionProperties(), null, getTableName()); - ourLog.info("Table {} has the following foreign keys: {}", getTableName(), foreignKeys); + logInfo(ourLog, "Table {} has the following foreign keys: {}", getTableName(), foreignKeys); Set indexNames = JdbcUtils.getIndexNames(getConnectionProperties(), getTableName()); - ourLog.info("Table {} has the following indexes: {}", getTableName(), indexNames); + logInfo(ourLog, "Table {} has the following indexes: {}", getTableName(), indexNames); for (String next : foreignKeys) { List sql = DropForeignKeyTask.generateSql(getTableName(), next, getDriverType()); @@ -60,12 +60,12 @@ public class DropTableTask extends BaseTableTask { for (String nextIndex : indexNames) { Optional sql = DropIndexTask.createDropIndexSql(getConnectionProperties(), getTableName(), nextIndex, getDriverType()); if (sql.isPresent()) { - ourLog.info("Dropping index {} on table {} in preparation for table delete", nextIndex, getTableName()); + logInfo(ourLog, "Dropping index {} on table {} in preparation for table delete", nextIndex, getTableName()); executeSql(getTableName(), sql.get()); } } - ourLog.info("Dropping table: {}", getTableName()); + logInfo(ourLog, "Dropping table: {}", getTableName()); String sql = "DROP TABLE " + getTableName(); executeSql(getTableName(), sql); diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ExecuteRawSqlTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ExecuteRawSqlTask.java index bf3b91a7c46..3c4c57beee2 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ExecuteRawSqlTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ExecuteRawSqlTask.java @@ -65,7 +65,7 @@ public class ExecuteRawSqlTask extends BaseTask { List sqlStatements = myDriverToSqls.computeIfAbsent(getDriverType(), t -> new ArrayList<>()); sqlStatements.addAll(myDriverNeutralSqls); - ourLog.info("Going to execute {} SQL statements", sqlStatements.size()); + logInfo(ourLog, "Going to execute {} SQL statements", sqlStatements.size()); for (String nextSql : sqlStatements) { executeSql(null, nextSql); diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ModifyColumnTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ModifyColumnTask.java index 79c8a268dc6..be20c30b97c 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ModifyColumnTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ModifyColumnTask.java @@ -49,7 +49,7 @@ public class ModifyColumnTask extends BaseTableColumnTypeTask Set columnNames = JdbcUtils.getColumnNames(getConnectionProperties(), getTableName()); if (!columnNames.contains(getColumnName())) { - ourLog.info("Column {} doesn't exist on table {} - No action performed", getColumnName(), getTableName()); + logInfo(ourLog, "Column {} doesn't exist on table {} - No action performed", getColumnName(), getTableName()); return; } @@ -71,7 +71,7 @@ public class ModifyColumnTask extends BaseTableColumnTypeTask boolean alreadyOfCorrectType = existingType.equals(getColumnType(), columnLength); boolean alreadyCorrectNullable = isNullable() == nullable; if (alreadyOfCorrectType && alreadyCorrectNullable) { - ourLog.info("Column {} on table {} is already of type {} and has nullable {} - No action performed", getColumnName(), getTableName(), existingType, nullable); + logInfo(ourLog, "Column {} on table {} is already of type {} and has nullable {} - No action performed", getColumnName(), getTableName(), existingType, nullable); return; } @@ -128,13 +128,13 @@ public class ModifyColumnTask extends BaseTableColumnTypeTask throw new IllegalStateException("Dont know how to handle " + getDriverType()); } - ourLog.info("Updating column {} on table {} to type {}", getColumnName(), getTableName(), type); + logInfo(ourLog, "Updating column {} on table {} to type {}", getColumnName(), getTableName(), type); if (sql != null) { executeSql(getTableName(), sql); } if (sqlNotNull != null) { - ourLog.info("Updating column {} on table {} to not null", getColumnName(), getTableName()); + logInfo(ourLog, "Updating column {} on table {} to not null", getColumnName(), getTableName()); executeSql(getTableName(), sqlNotNull); } } diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/RenameColumnTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/RenameColumnTask.java index 978a9519301..b02cf0b5dcb 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/RenameColumnTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/RenameColumnTask.java @@ -76,7 +76,7 @@ public class RenameColumnTask extends BaseTableTask { throw new SQLException("Can not rename " + getTableName() + "." + myOldName + " to " + myNewName + " because both columns exist and data exists in " + myNewName); } - ourLog.info("Table {} has columns {} and {} - Going to drop {} before renaming", getTableName(), myOldName, myNewName, myNewName); + logInfo(ourLog, "Table {} has columns {} and {} - Going to drop {} before renaming", getTableName(), myOldName, myNewName, myNewName); String sql = DropColumnTask.createSql(getTableName(), myNewName); executeSql(getTableName(), sql); } else { @@ -88,7 +88,7 @@ public class RenameColumnTask extends BaseTableTask { } throw new SQLException("Can not rename " + getTableName() + "." + myOldName + " to " + myNewName + " because neither column exists!"); } else if (haveNewName) { - ourLog.info("Column {} already exists on table {} - No action performed", myNewName, getTableName()); + logInfo(ourLog, "Column {} already exists on table {} - No action performed", myNewName, getTableName()); return; } @@ -117,7 +117,7 @@ public class RenameColumnTask extends BaseTableTask { throw new IllegalStateException(); } - ourLog.info("Renaming column {} on table {} to {}", myOldName, getTableName(), myNewName); + logInfo(ourLog, "Renaming column {} on table {} to {}", myOldName, getTableName(), myNewName); executeSql(getTableName(), sql); }