From bf9f6d213bf6b3bf4fd7e15430ada8c9954e69ce Mon Sep 17 00:00:00 2001 From: jbertram Date: Wed, 24 Jun 2015 13:33:27 -0500 Subject: [PATCH] ARTEMIS-104 missing i18n warns --- .../cli/commands/tools/XmlDataImporter.java | 2 +- .../jms/server/ActiveMQJMSServerLogger.java | 6 ++ .../jms/server/impl/JMSServerManagerImpl.java | 2 +- .../protocol/openwire/amq/AMQSession.java | 5 +- .../activemq/artemis/ra/ActiveMQRALogger.java | 8 +++ .../artemis/ra/inflow/ActiveMQActivation.java | 2 +- .../ra/inflow/ActiveMQMessageHandler.java | 2 +- .../cursor/impl/PageSubscriptionImpl.java | 2 +- .../impl/journal/JournalStorageManager.java | 3 +- .../core/postoffice/impl/BindingsImpl.java | 2 +- .../core/replication/ReplicationManager.java | 4 +- .../core/server/ActiveMQMessageBundle.java | 4 +- .../artemis/core/server/ActiveMQServer.java | 2 +- .../core/server/ActiveMQServerLogger.java | 63 +++++++++++++++++-- .../core/server/cluster/ClusterManager.java | 4 +- .../cluster/impl/ClusterConnectionImpl.java | 3 +- .../core/server/impl/ActiveMQServerImpl.java | 9 +-- .../artemis/core/server/impl/QueueImpl.java | 2 +- 18 files changed, 96 insertions(+), 29 deletions(-) diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/XmlDataImporter.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/XmlDataImporter.java index be42039502..4bb620a3eb 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/XmlDataImporter.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/XmlDataImporter.java @@ -405,7 +405,7 @@ public final class XmlDataImporter implements Action File tempFile = new File(tempFileName); if (!tempFile.delete()) { - ActiveMQServerLogger.LOGGER.warn("Could not delete: " + tempFileName); + ActiveMQServerLogger.LOGGER.couldNotDeleteTempFile(tempFileName); } tempFileName = ""; } diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/ActiveMQJMSServerLogger.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/ActiveMQJMSServerLogger.java index d277f377dd..ed808ccd22 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/ActiveMQJMSServerLogger.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/ActiveMQJMSServerLogger.java @@ -95,6 +95,12 @@ public interface ActiveMQJMSServerLogger extends BasicLogger format = Message.Format.MESSAGE_FORMAT) void failedToCorrectHost(@Cause Exception e, String name); + @LogMessage(level = Logger.Level.WARN) + @Message(id = 122018, + value = "Failed to send notification: {0}", + format = Message.Format.MESSAGE_FORMAT) + void failedToSendNotification(String notification); + @LogMessage(level = Logger.Level.ERROR) @Message(id = 124000, value = "key attribute missing for JMS configuration {0}" , format = Message.Format.MESSAGE_FORMAT) void jmsConfigMissingKey(Node e); diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java index 248f1222f7..6a4856b49f 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java @@ -1200,7 +1200,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback } catch (Exception e) { - ActiveMQJMSServerLogger.LOGGER.warn("Failed to send notification : " + notif); + ActiveMQJMSServerLogger.LOGGER.failedToSendNotification(notif.toString()); } } diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java index 6e848be63a..3b166f0669 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java @@ -595,10 +595,7 @@ public class AMQSession implements SessionCallback long now = System.currentTimeMillis(); if (now >= nextWarn) { - ActiveMQServerLogger.LOGGER.warn("Memory Limit reached. Producer (" + producerId + ") stopped to prevent flooding " - + result.getBlockingAddress() - + " See http://activemq.apache.org/producer-flow-control.html for more info" - + " (blocking for " + ((now - start) / 1000) + "s"); + ActiveMQServerLogger.LOGGER.memoryLimitReached(producerId.toString(), result.getBlockingAddress().toString(), ((now - start) / 1000)); nextWarn = now + blockedProducerWarningInterval; } } diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRALogger.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRALogger.java index 4497c3cfad..a34f592280 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRALogger.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRALogger.java @@ -97,6 +97,14 @@ public interface ActiveMQRALogger extends BasicLogger @Message(id = 152006, value = "Unable to call after delivery", format = Message.Format.MESSAGE_FORMAT) void unableToCallAfterDelivery(@Cause Exception e); + @LogMessage(level = Logger.Level.WARN) + @Message(id = 152007, value = "Thread {0} could not be finished", format = Message.Format.MESSAGE_FORMAT) + void threadCouldNotFinish(String thread); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 152008, value = "Error interrupting handler on endpoint {0} handler = {1}", format = Message.Format.MESSAGE_FORMAT) + void errorInterruptingHandler(String endpoint, String handler, @Cause Throwable cause); + @LogMessage(level = Logger.Level.ERROR) @Message(id = 154000, value = "Error while creating object Reference.", format = Message.Format.MESSAGE_FORMAT) void errorCreatingReference(@Cause Exception e); diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java index 71eada9a0d..1d9de07942 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java @@ -477,7 +477,7 @@ public class ActiveMQActivation if (threadTearDown.isAlive()) { - ActiveMQRALogger.LOGGER.warn("Thread " + threadTearDown + " couldn't be finished"); + ActiveMQRALogger.LOGGER.threadCouldNotFinish(threadTearDown.toString()); } } diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java index a889cdbc73..905b0decbf 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java @@ -228,7 +228,7 @@ public class ActiveMQMessageHandler implements MessageHandler } catch (Throwable e) { - ActiveMQRALogger.LOGGER.warn("Error interrupting handler on endpoint " + endpoint + " handler=" + consumer); + ActiveMQRALogger.LOGGER.errorInterruptingHandler(endpoint.toString(), consumer.toString(), e); } return null; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java index f19363df7b..39324dad02 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java @@ -923,7 +923,7 @@ final class PageSubscriptionImpl implements PageSubscription { // This could become null if the page file was deleted, or if the queue was removed maybe? // it's better to diagnose it (based on support tickets) instead of NPE - ActiveMQServerLogger.LOGGER.warn("PageCursorInfo == null on address " + this.getPagingStore().getAddress() + ", pos = " + pos + ", queue = " + cursorId); + ActiveMQServerLogger.LOGGER.nullPageCursorInfo(this.getPagingStore().getAddress().toString(), pos.toString(), cursorId); } else { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/JournalStorageManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/JournalStorageManager.java index e74215dea9..5104b6861c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/JournalStorageManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/JournalStorageManager.java @@ -2765,8 +2765,7 @@ public class JournalStorageManager implements StorageManager long messageID = buff.readLong(); if (!pendingLargeMessages.remove(new Pair(recordDeleted.id, messageID))) { - // TODO: Logging - ActiveMQServerLogger.LOGGER.warn("Large message " + recordDeleted.id + " wasn't found when dealing with add pending large message"); + ActiveMQServerLogger.LOGGER.largeMessageNotFound(recordDeleted.id); } installLargeMessageConfirmationOnTX(tx, recordDeleted.id); break; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java index 0c85abfd63..927d049b70 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java @@ -686,7 +686,7 @@ public final class BindingsImpl implements Bindings } else { - ActiveMQServerLogger.LOGGER.warn("Couldn't find binding with id=" + bindingID + " on routeFromCluster for message=" + message + " binding = " + this); + ActiveMQServerLogger.LOGGER.bindingNotFound(bindingID, message.toString(), this.toString()); } } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java index f5c112f51d..a2f39c967f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java @@ -649,10 +649,10 @@ public final class ReplicationManager implements ActiveMQComponent */ public OperationContext sendLiveIsStopping(final LiveStopping finalMessage) { - ActiveMQServerLogger.LOGGER.warn("LIVE IS STOPPING?!? message=" + finalMessage + " enabled=" + enabled); + ActiveMQServerLogger.LOGGER.debug("LIVE IS STOPPING?!? message=" + finalMessage + " enabled=" + enabled); if (enabled) { - ActiveMQServerLogger.LOGGER.warn("LIVE IS STOPPING?!? message=" + finalMessage + " " + enabled); + ActiveMQServerLogger.LOGGER.debug("LIVE IS STOPPING?!? message=" + finalMessage + " " + enabled); return sendReplicatePacket(new ReplicationLiveIsStoppingMessage(finalMessage)); } return null; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java index a8bd7e18d0..ad8220e95a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java @@ -60,8 +60,8 @@ public interface ActiveMQMessageBundle @Message(id = 119000, value = "Activation for server {0}", format = Message.Format.MESSAGE_FORMAT) String activationForServer(ActiveMQServer server); - @Message(id = 119001, value = "Generating thread dump because - {0}", format = Message.Format.MESSAGE_FORMAT) - String generatingThreadDump(String reason); + @Message(id = 119001, value = "Generating thread dump", format = Message.Format.MESSAGE_FORMAT) + String generatingThreadDump(); @Message(id = 119002, value = "Thread {0} name = {1} id = {2} group = {3}", format = Message.Format.MESSAGE_FORMAT) String threadDump(Thread key, String name, Long id, ThreadGroup threadGroup); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java index 307c375afe..1de2ee6962 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java @@ -248,7 +248,7 @@ public interface ActiveMQServer extends ActiveMQComponent ServerSession getSessionByID(String sessionID); - void threadDump(String reason); + void threadDump(); /** * return true if there is a binding for this address (i.e. if there is a created queue) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java index 10c0d49bf6..231b94c680 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java @@ -356,10 +356,6 @@ public interface ActiveMQServerLogger extends BasicLogger @Message(id = 222014, value = "Error when trying to stop replication", format = Message.Format.MESSAGE_FORMAT) void errorStoppingReplication(@Cause Exception e); - @LogMessage(level = Logger.Level.WARN) - @Message(id = 222015, value = "{0}", format = Message.Format.MESSAGE_FORMAT) - void warn(String message); - @LogMessage(level = Logger.Level.WARN) @Message(id = 222016, value = "Cannot deploy a connector with no name specified.", format = Message.Format.MESSAGE_FORMAT) void connectorWithNoName(); @@ -1110,6 +1106,65 @@ public interface ActiveMQServerLogger extends BasicLogger format = Message.Format.MESSAGE_FORMAT) void cannotFindRoleForUser(String user); + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222192, + value = "Could not delete: {0}", + format = Message.Format.MESSAGE_FORMAT) + void couldNotDeleteTempFile(String tempFileName); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222193, + value = "Memory Limit reached. Producer ({0}) stopped to prevent flooding {1} (blocking for {2}s). See http://activemq.apache.org/producer-flow-control.html for more info.", + format = Message.Format.MESSAGE_FORMAT) + void memoryLimitReached(String producerID, String address, long duration); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222194, + value = "PageCursorInfo == null on address {0}, pos = {1}, queue = {2}.", + format = Message.Format.MESSAGE_FORMAT) + void nullPageCursorInfo(String address, String position, long id); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222195, + value = "Large message {0} wasn't found when dealing with add pending large message", + format = Message.Format.MESSAGE_FORMAT) + void largeMessageNotFound(long id); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222196, + value = "Couldn't find binding with id={0} on routeFromCluster for message={1} binding = {2}", + format = Message.Format.MESSAGE_FORMAT) + void bindingNotFound(long id, String message, String binding); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222197, + value = "Internal error! Delivery logic has identified a non delivery and still handled a consumer!", + format = Message.Format.MESSAGE_FORMAT) + void nonDeliveryHandled(); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222198, + value = "Couldn't flush ClusterManager executor ({0}) in 10 seconds, verify your thread pool size", + format = Message.Format.MESSAGE_FORMAT) + void couldNotFlushClusterManager(String manager); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222199, + value = "Thread dump: {0}", + format = Message.Format.MESSAGE_FORMAT) + void threadDump(String manager); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222200, + value = "Couldn't finish executor on {0}", + format = Message.Format.MESSAGE_FORMAT) + void couldNotFinishExecutor(String clusterConnection); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222201, + value = "Timed out waiting for backup activation to exit", + format = Message.Format.MESSAGE_FORMAT) + void backupActivationTimeout(); @LogMessage(level = Logger.Level.ERROR) @Message(id = 224000, value = "Failure in initialisation", format = Message.Format.MESSAGE_FORMAT) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java index 44cb44c9a7..4640f81b72 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java @@ -391,8 +391,8 @@ public final class ClusterManager implements ActiveMQComponent executor.execute(future); if (!future.await(10000)) { - server.threadDump("Couldn't flush ClusterManager executor (" + this + - ") in 10 seconds, verify your thread pool size"); + ActiveMQServerLogger.LOGGER.couldNotFlushClusterManager(this.toString()); + server.threadDump(); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java index 9caf330092..7a0d780e0a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java @@ -386,7 +386,8 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn executor.execute(future); if (!future.await(10000)) { - server.threadDump("Couldn't finish executor on " + this); + ActiveMQServerLogger.LOGGER.couldNotFinishExecutor(this.toString()); + server.threadDump(); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java index fddd13a9a0..0dc85de41b 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java @@ -491,7 +491,8 @@ public class ActiveMQServerImpl implements ActiveMQServer if (System.currentTimeMillis() - start >= timeout) { - threadDump("Timed out waiting for backup activation to exit"); + ActiveMQServerLogger.LOGGER.backupActivationTimeout(); + threadDump(); } } @@ -576,14 +577,14 @@ public class ActiveMQServerImpl implements ActiveMQServer return postOffice.isAddressBound(SimpleString.toSimpleString(address)); } - public void threadDump(final String reason) + public void threadDump() { StringWriter str = new StringWriter(); PrintWriter out = new PrintWriter(str); Map stackTrace = Thread.getAllStackTraces(); - out.println(ActiveMQMessageBundle.BUNDLE.generatingThreadDump(reason)); + out.println(ActiveMQMessageBundle.BUNDLE.generatingThreadDump()); out.println("*******************************************************************************"); for (Map.Entry el : stackTrace.entrySet()) @@ -601,7 +602,7 @@ public class ActiveMQServerImpl implements ActiveMQServer out.println(ActiveMQMessageBundle.BUNDLE.endThreadDump()); out.println("*******************************************************************************"); - ActiveMQServerLogger.LOGGER.warn(str.toString()); + ActiveMQServerLogger.LOGGER.threadDump(str.toString()); } public final void stop(boolean failoverOnServerShutdown) throws Exception diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java index 3fd5801fc8..8e0d1ff375 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java @@ -2182,7 +2182,7 @@ public class QueueImpl implements Queue { // this shouldn't really happen, // however I'm keeping this as an assertion case future developers ever change the logic here on this class - ActiveMQServerLogger.LOGGER.warn("Internal error! Delivery logic has identified a non delivery and still handled a consumer!"); + ActiveMQServerLogger.LOGGER.nonDeliveryHandled(); } else {