activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From martyntay...@apache.org
Subject [1/2] activemq-artemis git commit: some minimal trace logs
Date Thu, 02 Jun 2016 13:11:13 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master e64ea5278 -> 6181c3930


some minimal trace logs


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/13384f31
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/13384f31
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/13384f31

Branch: refs/heads/master
Commit: 13384f311375a8a0cb63cfe9ebf770a87549389c
Parents: e64ea52
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Wed Jun 1 18:04:56 2016 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Wed Jun 1 18:12:08 2016 -0400

----------------------------------------------------------------------
 .../apache/activemq/artemis/jdbc/store/JDBCUtils.java   | 12 ++++++++++++
 .../artemis/jdbc/store/journal/JDBCJournalImpl.java     | 10 ++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/13384f31/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/JDBCUtils.java
----------------------------------------------------------------------
diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/JDBCUtils.java
b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/JDBCUtils.java
index 8ce08c6..c63e323 100644
--- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/JDBCUtils.java
+++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/JDBCUtils.java
@@ -30,9 +30,11 @@ import org.apache.activemq.artemis.jdbc.store.drivers.postgres.PostgresSequentia
 import org.apache.activemq.artemis.jdbc.store.file.JDBCSequentialFileFactoryDriver;
 import org.apache.activemq.artemis.jdbc.store.sql.GenericSQLProvider;
 import org.apache.activemq.artemis.jdbc.store.sql.SQLProvider;
+import org.jboss.logging.Logger;
 
 public class JDBCUtils {
 
+   private static final Logger logger = Logger.getLogger(JDBCUtils.class);
    public static Driver getDriver(String className) throws Exception {
 
       try {
@@ -62,8 +64,10 @@ public class JDBCUtils {
    }
 
    public static void createTableIfNotExists(Connection connection, String tableName, String
sql) throws SQLException {
+      logger.tracef("Validating if table %s didn't exist before creating", tableName);
       ResultSet rs = connection.getMetaData().getTables(null, null, tableName, null);
       if (!rs.next()) {
+         logger.tracef("Table %s did not exist, creating it with SQL=%s", tableName, sql);
          Statement statement = connection.createStatement();
          statement.executeUpdate(sql);
       }
@@ -71,15 +75,19 @@ public class JDBCUtils {
 
    public static SQLProvider getSQLProvider(String driverClass, String tableName) {
       if (driverClass.contains("derby")) {
+         logger.tracef("getSQLProvider Returning Derby SQL provider for driver::%s, tableName::%s",
driverClass, tableName);
          return new DerbySQLProvider(tableName);
       }
       else if (driverClass.contains("postgres")) {
+         logger.tracef("getSQLProvider Returning postgres SQL provider for driver::%s, tableName::%s",
driverClass, tableName);
          return new PostgresSQLProvider(tableName);
       }
       else if (driverClass.contains("mysql")) {
+         logger.tracef("getSQLProvider Returning mysql SQL provider for driver::%s, tableName::%s",
driverClass, tableName);
          return new MySQLSQLProvider(tableName);
       }
       else {
+         logger.tracef("getSQLProvider Returning generic SQL provider for driver::%s, tableName::%s",
driverClass, tableName);
          return new GenericSQLProvider(tableName);
       }
    }
@@ -89,24 +97,28 @@ public class JDBCUtils {
                                                                  String jdbcConnectionUrl)
throws SQLException {
       JDBCSequentialFileFactoryDriver dbDriver;
       if (driverClass.contains("derby")) {
+         logger.tracef("getDBFileDriver Returning Derby SQL provider for driver::%s, tableName::%s",
driverClass, tableName);
          dbDriver = new JDBCSequentialFileFactoryDriver();
          dbDriver.setSqlProvider(new DerbySQLProvider(tableName));
          dbDriver.setJdbcConnectionUrl(jdbcConnectionUrl);
          dbDriver.setJdbcDriverClass(driverClass);
       }
       else if (driverClass.contains("postgres")) {
+         logger.tracef("getDBFileDriver Returning postgres SQL provider for driver::%s, tableName::%s",
driverClass, tableName);
          dbDriver = new PostgresSequentialSequentialFileDriver();
          dbDriver.setSqlProvider(new PostgresSQLProvider(tableName));
          dbDriver.setJdbcConnectionUrl(jdbcConnectionUrl);
          dbDriver.setJdbcDriverClass(driverClass);
       }
       else if (driverClass.contains("mysql")) {
+         logger.tracef("getDBFileDriver Returning mysql SQL provider for driver::%s, tableName::%s",
driverClass, tableName);
          dbDriver = new JDBCSequentialFileFactoryDriver();
          dbDriver.setSqlProvider(new MySQLSQLProvider(tableName));
          dbDriver.setJdbcConnectionUrl(jdbcConnectionUrl);
          dbDriver.setJdbcDriverClass(driverClass);
       }
       else {
+         logger.tracef("getDBFileDriver generic mysql SQL provider for driver::%s, tableName::%s",
driverClass, tableName);
          dbDriver = new JDBCSequentialFileFactoryDriver();
          dbDriver.setSqlProvider(new GenericSQLProvider(tableName));
          dbDriver.setJdbcConnectionUrl(jdbcConnectionUrl);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/13384f31/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalImpl.java
----------------------------------------------------------------------
diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalImpl.java
b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalImpl.java
index 6c05112..81fd683 100644
--- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalImpl.java
+++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalImpl.java
@@ -44,6 +44,9 @@ import org.jboss.logging.Logger;
 
 public class JDBCJournalImpl extends AbstractJDBCDriver implements Journal {
 
+
+   private static final Logger logger = Logger.getLogger(JDBCJournalImpl.class);
+
    // Sync Delay in ms
    public static final int SYNC_DELAY = 5;
 
@@ -75,8 +78,6 @@ public class JDBCJournalImpl extends AbstractJDBCDriver implements Journal
{
    // Sequence ID for journal records
    private AtomicLong seq = new AtomicLong(0);
 
-   private Logger logger = Logger.getLogger(this.getClass());
-
    public JDBCJournalImpl(String jdbcUrl, String tableName, String jdbcDriverClass) {
       super(tableName, jdbcUrl, jdbcDriverClass);
       timerThread = "Timer JDBC Journal(" + tableName + ")";
@@ -97,6 +98,7 @@ public class JDBCJournalImpl extends AbstractJDBCDriver implements Journal
{
 
    @Override
    protected void prepareStatements() throws SQLException {
+      logger.tracef("preparing statements");
       insertJournalRecords = connection.prepareStatement(sqlProvider.getInsertJournalRecordsSQL());
       selectJournalRecords = connection.prepareStatement(sqlProvider.getSelectJournalRecordsSQL());
       countJournalRecords = connection.prepareStatement(sqlProvider.getCountJournalRecordsSQL());
@@ -676,12 +678,12 @@ public class JDBCJournalImpl extends AbstractJDBCDriver implements Journal
{
 
    @Override
    public final void synchronizationLock() {
-      logger.error("Replication is not supported with JDBC Store");
+      logger.error("Replication is not supported with JDBC Store", new Exception("trace"));
    }
 
    @Override
    public final void synchronizationUnlock() {
-      logger.error("Replication is not supported with JDBC Store");
+      logger.error("Replication is not supported with JDBC Store", new Exception("trace"));
    }
 
    @Override


Mime
View raw message