This is an automated email from the ASF dual-hosted git repository. clebertsuconic pushed a commit to branch new-logging in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit 5c4e8b420cd1135206d10d298666d8cd91a718b8 Author: Robbie Gemmell <rob...@apache.org> AuthorDate: Mon May 9 12:45:47 2022 +0100 make start on artemis-jdbc-store to highlight some needed conversions --- .../jdbc/store/drivers/AbstractJDBCDriver.java | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/AbstractJDBCDriver.java b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/AbstractJDBCDriver.java index 24b622f748..c954d147ec 100644 --- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/AbstractJDBCDriver.java +++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/AbstractJDBCDriver.java @@ -25,7 +25,8 @@ import java.util.Arrays; import java.util.stream.Stream; import org.apache.activemq.artemis.jdbc.store.sql.SQLProvider; -import org.jboss.logging.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Class to hold common database functionality such as drivers and connections @@ -33,7 +34,7 @@ import org.jboss.logging.Logger; @SuppressWarnings("SynchronizeOnNonFinalField") public abstract class AbstractJDBCDriver { - private static final Logger logger = Logger.getLogger(AbstractJDBCDriver.class); + private static final Logger logger = LoggerFactory.getLogger(AbstractJDBCDriver.class); protected SQLProvider sqlProvider; @@ -87,7 +88,7 @@ public abstract class AbstractJDBCDriver { } private void createTableIfNotExists(String tableName, String... sqls) throws SQLException { - logger.tracef("Validating if table %s didn't exist before creating", tableName); + logger.trace("Validating if table {} didn't exist before creating", tableName); try (Connection connection = connectionProvider.getConnection()) { try { connection.setAutoCommit(false); @@ -96,7 +97,7 @@ public abstract class AbstractJDBCDriver { if (rs == null || !rs.next()) { tableExists = false; if (logger.isTraceEnabled()) { - logger.tracef("Table %s did not exist, creating it with SQL=%s", tableName, Arrays.toString(sqls)); + logger.trace("Table {} did not exist, creating it with SQL={}", tableName, Arrays.toString(sqls)); } if (rs != null) { final SQLWarning sqlWarning = rs.getWarnings(); @@ -109,13 +110,13 @@ public abstract class AbstractJDBCDriver { } } if (tableExists) { - logger.tracef("Validating if the existing table %s is initialized or not", tableName); + logger.trace("Validating if the existing table {} is initialized or not", tableName); try (Statement statement = connection.createStatement(); ResultSet cntRs = statement.executeQuery(sqlProvider.getCountJournalRecordsSQL())) { - logger.tracef("Validation of the existing table %s initialization is started", tableName); + logger.trace("Validation of the existing table {} initialization is started", tableName); int rows; if (cntRs.next() && (rows = cntRs.getInt(1)) > 0) { - logger.tracef("Table %s did exist but is not empty. Skipping initialization. Found %d rows.", tableName, rows); + logger.trace("Table {} did exist but is not empty. Skipping initialization. Found %d rows.", tableName, rows); if (logger.isDebugEnabled()) { final long expectedRows = Stream.of(sqls).map(String::toUpperCase).filter(sql -> sql.contains("INSERT INTO")).count(); if (rows < expectedRows) { @@ -130,9 +131,9 @@ public abstract class AbstractJDBCDriver { return !(upperCaseSql.contains("CREATE TABLE") || upperCaseSql.contains("CREATE INDEX")); }).toArray(String[]::new); if (sqls.length > 0) { - logger.tracef("Table %s did exist but is empty. Starting initialization.", tableName); + logger.trace("Table {} did exist but is empty. Starting initialization.", tableName); } else { - logger.tracef("Table %s did exist but is empty. Initialization completed: no initialization statements left.", tableName); + logger.trace("Table {} did exist but is empty. Initialization completed: no initialization statements left.", tableName); connection.commit(); } } @@ -149,7 +150,7 @@ public abstract class AbstractJDBCDriver { logger.debug("Rollback failed while validating initialization of a table", rollbackEx); } connection.setAutoCommit(false); - logger.tracef("Table %s seems to exist, but we can't verify the initialization. Keep trying to create and initialize.", tableName); + logger.trace("Table {} seems to exist, but we can't verify the initialization. Keep trying to create and initialize.", tableName); } } if (sqls.length > 0) {