You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2022/05/11 13:30:27 UTC

[activemq-artemis] branch new-logging updated: Addressing TODOs: we should never have any wrong class names, no more usage of LOGGER.error, always remove those

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


The following commit(s) were added to refs/heads/new-logging by this push:
     new a483ff57c7 Addressing TODOs: we should never have any wrong class names, no more usage of LOGGER.error, always remove those
a483ff57c7 is described below

commit a483ff57c7abacb4f66357c19911a58cdb74f0cd
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Wed May 11 09:30:13 2022 -0400

    Addressing TODOs: we should never have any wrong class names, no more usage of LOGGER.error, always remove those
---
 .../activemq/artemis/jdbc/store/drivers/JDBCConnectionProvider.java | 4 +---
 .../activemq/artemis/jdbc/store/file/JDBCSequentialFileFactory.java | 6 ++----
 .../activemq/artemis/jdbc/store/journal/JDBCJournalRecord.java      | 6 +++++-
 .../apache/activemq/artemis/jdbc/store/sql/PropertySQLProvider.java | 4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCConnectionProvider.java b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCConnectionProvider.java
index 98c32e9d44..0dd5d311aa 100644
--- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCConnectionProvider.java
+++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/JDBCConnectionProvider.java
@@ -80,9 +80,7 @@ public class JDBCConnectionProvider {
             } catch (SQLException e) {
                supportNetworkTimeout = false;
                logger.warn(JDBCUtils.appendSQLExceptionDetails(new StringBuilder(), e).toString());
-               // TODO: looks like this used the "ActiveMQJournalLogger.class.getPackage().getName()" logger before, not this class own named logger.
-               //       Should it still, or swap to the local one? If former should it have a code?
-               ActiveMQJournalLogger.LOGGER.warn("Unable to set a network timeout on the JDBC connection: won't retry again in the future");
+               logger.warn("Unable to set a network timeout on the JDBC connection: won't retry again in the future");
             } catch (Throwable throwable) {
                supportNetworkTimeout = false;
                //it included SecurityExceptions and UnsupportedOperationException
diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactory.java b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactory.java
index b876877af9..22cfe5b089 100644
--- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactory.java
+++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactory.java
@@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory;
 
 public class JDBCSequentialFileFactory implements SequentialFileFactory, ActiveMQComponent {
 
-   private static final Logger logger = LoggerFactory.getLogger(JDBCSequentialFile.class);//TODO: wrong logger name?
+   private static final Logger logger = LoggerFactory.getLogger(JDBCSequentialFileFactory.class);
 
    private boolean started;
 
@@ -105,9 +105,7 @@ public class JDBCSequentialFileFactory implements SequentialFileFactory, ActiveM
       try {
          dbDriver.stop();
       } catch (SQLException e) {
-         // TODO: looks like this used the "ActiveMQJournalLogger.class.getPackage().getName()" logger before, not this class own named logger.
-         //       Should it still, or swap to the local one? If former should it have a code?
-         ActiveMQJournalLogger.LOGGER.error("Error stopping file factory, unable to close db connection");
+         logger.error("Error stopping file factory, unable to close db connection");
       }
       started = false;
    }
diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalRecord.java b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalRecord.java
index 68a203d463..c21405d874 100644
--- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalRecord.java
+++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/journal/JDBCJournalRecord.java
@@ -33,8 +33,12 @@ import org.apache.activemq.artemis.core.persistence.Persister;
 import org.apache.activemq.artemis.core.journal.RecordInfo;
 import org.apache.activemq.artemis.journal.ActiveMQJournalLogger;
 import org.apache.activemq.artemis.utils.ActiveMQBufferInputStream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 class JDBCJournalRecord {
+
+   private static final Logger logger = LoggerFactory.getLogger(JDBCJournalRecord.class);
    /*
    Database Table Schema:
 
@@ -139,7 +143,7 @@ class JDBCJournalRecord {
       } catch (IOException e) {
           // TODO: looks like this used the "ActiveMQJournalLogger.class.getPackage().getName()" logger before, not this class own named logger.
           //       Should it still, or swap to the local one? If former should it have a code?
-         ActiveMQJournalLogger.LOGGER.error("Error occurred whilst reading Journal Record", e);
+         logger.error("Error occurred whilst reading Journal Record", e);
          throw e;
       }
 
diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/sql/PropertySQLProvider.java b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/sql/PropertySQLProvider.java
index 32c1f4262f..c04d398fe9 100644
--- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/sql/PropertySQLProvider.java
+++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/sql/PropertySQLProvider.java
@@ -28,7 +28,6 @@ import java.util.function.Function;
 import java.util.stream.Stream;
 
 import org.apache.activemq.artemis.jdbc.store.drivers.JDBCConnectionProvider;
-import org.apache.activemq.artemis.jdbc.store.journal.JDBCJournalImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -43,6 +42,8 @@ import static java.lang.String.format;
  */
 public class PropertySQLProvider implements SQLProvider {
 
+   private static final Logger logger = LoggerFactory.getLogger(PropertySQLProvider.class);
+
    private enum LetterCase implements Function<String, String> {
       upper(String::toUpperCase),
       lower(String::toLowerCase),
@@ -306,7 +307,6 @@ public class PropertySQLProvider implements SQLProvider {
 
    public static final class Factory implements SQLProvider.Factory {
 
-      private static final Logger logger = LoggerFactory.getLogger(JDBCJournalImpl.class); //TODO: wrong logger name or deliberate?
       private static final String SQL_PROPERTIES_FILE = "journal-sql.properties";
       // can be null if no known dialect has been identified
       private SQLDialect dialect;