You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ro...@apache.org on 2022/05/13 11:52:26 UTC
[activemq-artemis] branch new-logging updated: convert logging for artemis-amqp-protocol
This is an automated email from the ASF dual-hosted git repository.
robbie 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 27c133b1a3 convert logging for artemis-amqp-protocol
27c133b1a3 is described below
commit 27c133b1a364e09d008ad7b0f1ba56ec1a9d53b8
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Fri May 13 12:51:13 2022 +0100
convert logging for artemis-amqp-protocol
---
artemis-protocols/artemis-amqp-protocol/pom.xml | 6 +++
.../amqp/logger/ActiveMQAMQPProtocolLogger.java | 45 ++++++++-----------
.../logger/ActiveMQAMQPProtocolMessageBundle.java | 50 +++++++++++-----------
.../amqp/proton/AMQPConnectionContext.java | 5 ++-
4 files changed, 50 insertions(+), 56 deletions(-)
diff --git a/artemis-protocols/artemis-amqp-protocol/pom.xml b/artemis-protocols/artemis-amqp-protocol/pom.xml
index 17e564043e..d0ceea9de9 100644
--- a/artemis-protocols/artemis-amqp-protocol/pom.xml
+++ b/artemis-protocols/artemis-amqp-protocol/pom.xml
@@ -48,6 +48,12 @@
<version>${project.version}</version>
</dependency>
<!-- logging -->
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-log-processor</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/logger/ActiveMQAMQPProtocolLogger.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/logger/ActiveMQAMQPProtocolLogger.java
index 93d038c371..bed138c7a8 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/logger/ActiveMQAMQPProtocolLogger.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/logger/ActiveMQAMQPProtocolLogger.java
@@ -16,11 +16,9 @@
*/
package org.apache.activemq.artemis.protocol.amqp.logger;
-import org.jboss.logging.BasicLogger;
-import org.jboss.logging.Logger;
-import org.jboss.logging.annotations.LogMessage;
-import org.jboss.logging.annotations.Message;
-import org.jboss.logging.annotations.MessageLogger;
+import org.apache.activemq.artemis.logprocessor.CodeFactory;
+import org.apache.activemq.artemis.logprocessor.annotation.LogBundle;
+import org.apache.activemq.artemis.logprocessor.annotation.LogMessage;
/**
* Logger Code 11
@@ -37,38 +35,29 @@ import org.jboss.logging.annotations.MessageLogger;
* so an INFO message would be 111000 to 111999
*/
-@MessageLogger(projectCode = "AMQ")
-public interface ActiveMQAMQPProtocolLogger extends BasicLogger {
+@LogBundle(projectCode = "AMQ")
+public interface ActiveMQAMQPProtocolLogger {
- /**
- * The default logger.
- */
- ActiveMQAMQPProtocolLogger LOGGER = Logger.getMessageLogger(ActiveMQAMQPProtocolLogger.class, ActiveMQAMQPProtocolLogger.class.getPackage().getName());
+ ActiveMQAMQPProtocolLogger LOGGER = CodeFactory.getCodeClass(ActiveMQAMQPProtocolLogger.class, ActiveMQAMQPProtocolLogger.class.getPackage().getName());
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 111000, value = "Scheduled task can't be removed from scheduledPool.", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 111000, value = "Scheduled task can't be removed from scheduledPool.", level = LogMessage.Level.WARN)
void cantRemovingScheduledTask();
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 111001, value = "\n*******************************************************************************************************************************" +
- "\nCould not re-establish AMQP Server Connection {0} on {1} after {2} retries" +
- "\n*******************************************************************************************************************************\n", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 111001, value = "\n*******************************************************************************************************************************" +
+ "\nCould not re-establish AMQP Server Connection {} on {} after {} retries" +
+ "\n*******************************************************************************************************************************\n", level = LogMessage.Level.WARN)
void retryConnectionFailed(String name, String hostAndPort, int currentRetry);
- @LogMessage(level = Logger.Level.INFO)
- @Message(id = 111002, value = "\n*******************************************************************************************************************************" +
- "\nRetrying Server AMQP Connection {0} on {1} retry {2} of {3}" +
- "\n*******************************************************************************************************************************\n", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 111002, value = "\n*******************************************************************************************************************************" +
+ "\nRetrying Server AMQP Connection {} on {} retry {} of {}" +
+ "\n*******************************************************************************************************************************\n", level = LogMessage.Level.INFO)
void retryConnection(String name, String hostAndPort, int currentRetry, int maxRetry);
- @LogMessage(level = Logger.Level.INFO)
- @Message(id = 111003, value = "\n*******************************************************************************************************************************" +
- "\nConnected on Server AMQP Connection {0} on {1} after {2} retries" +
- "\n*******************************************************************************************************************************\n", format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 111003, value = "\n*******************************************************************************************************************************" +
+ "\nConnected on Server AMQP Connection {} on {} after {} retries" +
+ "\n*******************************************************************************************************************************\n", level = LogMessage.Level.INFO)
void successReconnect(String name, String hostAndPort, int currentRetry);
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 111004, value = "AddressFullPolicy clash on an anonymous producer between destinations {0}(addressFullPolicy={1}) and {2}(addressFullPolicy={3}). This could lead to semantic inconsistencies on your clients. Notice you could have other instances of this scenario however this message will only be logged once. log.debug output would show all instances of this event.",
- format = Message.Format.MESSAGE_FORMAT)
+ @LogMessage(id = 111004, value = "AddressFullPolicy clash on an anonymous producer between destinations {}(addressFullPolicy={}) and {}(addressFullPolicy={}). This could lead to semantic inconsistencies on your clients. Notice you could have other instances of this scenario however this message will only be logged once. log.debug output would show all instances of this event.", level = LogMessage.Level.WARN)
void incompatibleAddressFullMessagePolicy(String oldAddress, String oldPolicy, String newAddress, String newPolicy);
}
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/logger/ActiveMQAMQPProtocolMessageBundle.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/logger/ActiveMQAMQPProtocolMessageBundle.java
index 0a66e4d986..d482f46b8a 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/logger/ActiveMQAMQPProtocolMessageBundle.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/logger/ActiveMQAMQPProtocolMessageBundle.java
@@ -16,14 +16,14 @@
*/
package org.apache.activemq.artemis.protocol.amqp.logger;
+import org.apache.activemq.artemis.logprocessor.CodeFactory;
+import org.apache.activemq.artemis.logprocessor.annotation.LogBundle;
+import org.apache.activemq.artemis.logprocessor.annotation.Message;
import org.apache.activemq.artemis.protocol.amqp.exceptions.ActiveMQAMQPIllegalStateException;
import org.apache.activemq.artemis.protocol.amqp.exceptions.ActiveMQAMQPInternalErrorException;
import org.apache.activemq.artemis.protocol.amqp.exceptions.ActiveMQAMQPInvalidFieldException;
import org.apache.activemq.artemis.protocol.amqp.exceptions.ActiveMQAMQPNotFoundException;
import org.apache.activemq.artemis.protocol.amqp.exceptions.ActiveMQAMQPSecurityException;
-import org.jboss.logging.Messages;
-import org.jboss.logging.annotations.Message;
-import org.jboss.logging.annotations.MessageBundle;
/**
* Logger Code 11
@@ -34,33 +34,33 @@ import org.jboss.logging.annotations.MessageBundle;
* Once released, methods should not be deleted as they may be referenced by knowledge base
* articles. Unused methods should be marked as deprecated.
*/
-@MessageBundle(projectCode = "AMQ")
+@LogBundle(projectCode = "AMQ")
public interface ActiveMQAMQPProtocolMessageBundle {
- ActiveMQAMQPProtocolMessageBundle BUNDLE = Messages.getBundle(ActiveMQAMQPProtocolMessageBundle.class);
+ ActiveMQAMQPProtocolMessageBundle BUNDLE = CodeFactory.getCodeClass(ActiveMQAMQPProtocolMessageBundle.class);
@Message(id = 119000, value = "target address not set")
ActiveMQAMQPInvalidFieldException targetAddressNotSet();
- @Message(id = 119001, value = "error creating temporary queue, {0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119001, value = "error creating temporary queue, {}")
ActiveMQAMQPInternalErrorException errorCreatingTemporaryQueue(String message);
@Message(id = 119002, value = "target address does not exist")
ActiveMQAMQPNotFoundException addressDoesntExist();
- @Message(id = 119003, value = "error finding temporary queue, {0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119003, value = "error finding temporary queue, {}")
ActiveMQAMQPNotFoundException errorFindingTemporaryQueue(String message);
- @Message(id = 119005, value = "error creating consumer, {0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119005, value = "error creating consumer, {}")
ActiveMQAMQPInternalErrorException errorCreatingConsumer(String message);
- @Message(id = 119006, value = "error starting consumer, {0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119006, value = "error starting consumer, {}")
ActiveMQAMQPIllegalStateException errorStartingConsumer(String message);
- @Message(id = 119007, value = "error acknowledging message {0}, {1}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119007, value = "error acknowledging message {}, {}")
ActiveMQAMQPIllegalStateException errorAcknowledgingMessage(String messageID, String message);
- @Message(id = 119008, value = "error cancelling message {0}, {1}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119008, value = "error cancelling message {}, {}")
ActiveMQAMQPIllegalStateException errorCancellingMessage(String messageID, String message);
@Message(id = 119010, value = "source address does not exist")
@@ -69,44 +69,42 @@ public interface ActiveMQAMQPProtocolMessageBundle {
@Message(id = 119011, value = "source address not set")
ActiveMQAMQPInvalidFieldException sourceAddressNotSet();
- @Message(id = 119012, value = "error rolling back coordinator: {0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119012, value = "error rolling back coordinator: {}")
ActiveMQAMQPIllegalStateException errorRollingbackCoordinator(String message);
- @Message(id = 119013, value = "error committing coordinator: {0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119013, value = "error committing coordinator: {}")
ActiveMQAMQPIllegalStateException errorCommittingCoordinator(String message);
- @Message(id = 119014, value = "Transaction not found: xid={0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119014, value = "Transaction not found: xid={}")
ActiveMQAMQPIllegalStateException txNotFound(String xidToString);
- @Message(id = 119015, value = "not authorized to create consumer, {0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119015, value = "not authorized to create consumer, {}")
ActiveMQAMQPSecurityException securityErrorCreatingConsumer(String message);
- @Message(id = 119016, value = "not authorized to create temporary destination, {0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119016, value = "not authorized to create temporary destination, {}")
ActiveMQAMQPSecurityException securityErrorCreatingTempDestination(String message);
- @Message(id = 119017, value = "not authorized to create producer, {0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119017, value = "not authorized to create producer, {}")
ActiveMQAMQPSecurityException securityErrorCreatingProducer(String message);
- @Message(id = 119018, value = "link is missing an offered capability declaration {0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119018, value = "link is missing an offered capability declaration {}")
ActiveMQAMQPIllegalStateException missingOfferedCapability(String capability);
- @Message(id = 119019, value = "There is no brokerID defined on the target connection. Connection will be closed.", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119019, value = "There is no brokerID defined on the target connection. Connection will be closed.")
ActiveMQAMQPIllegalStateException missingBrokerID();
- @Message(id = 119020, value = "The Broker Connection Open Callback Has Timed Out.", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119020, value = "The Broker Connection Open Callback Has Timed Out.")
ActiveMQAMQPIllegalStateException brokerConnectionTimeout();
- @Message(id = 119021, value = "The broker connection had a remote link closed unexpectedly", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119021, value = "The broker connection had a remote link closed unexpectedly")
ActiveMQAMQPIllegalStateException brokerConnectionRemoteLinkClosed();
- @Message(id = 119022, value = "The broker connection is trying to connect to itself. Check your configuration.", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119022, value = "The broker connection is trying to connect to itself. Check your configuration.")
ActiveMQAMQPIllegalStateException brokerConnectionMirrorItself();
- @Message(id = 119023, value = "Sender link refused for address {0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119023, value = "Sender link refused for address {}")
ActiveMQAMQPIllegalStateException senderLinkRefused(String address);
- @Message(id = 119024, value = "link is missing a desired capability declaration {0}", format = Message.Format.MESSAGE_FORMAT)
+ @Message(id = 119024, value = "link is missing a desired capability declaration {}")
ActiveMQAMQPIllegalStateException missingDesiredCapability(String capability);
-
-
}
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java
index 35b5b8f98c..a1ecc7014c 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPConnectionContext.java
@@ -72,7 +72,8 @@ import org.apache.qpid.proton.engine.Receiver;
import org.apache.qpid.proton.engine.Sender;
import org.apache.qpid.proton.engine.Session;
import org.apache.qpid.proton.engine.Transport;
-import org.jboss.logging.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import static org.apache.activemq.artemis.protocol.amqp.proton.AmqpSupport.FAILOVER_SERVER_LIST;
import static org.apache.activemq.artemis.protocol.amqp.proton.AmqpSupport.HOSTNAME;
@@ -82,7 +83,7 @@ import static org.apache.activemq.artemis.protocol.amqp.proton.AmqpSupport.SCHEM
public class AMQPConnectionContext extends ProtonInitializable implements EventHandler {
- private static final Logger log = Logger.getLogger(AMQPConnectionContext.class);
+ private static final Logger log = LoggerFactory.getLogger(AMQPConnectionContext.class);
public static final Symbol CONNECTION_OPEN_FAILED = Symbol.valueOf("amqp:connection-establishment-failed");
public static final String AMQP_CONTAINER_ID = "amqp-container-id";