diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java index ef111714f2..ff68f153b5 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java @@ -918,7 +918,7 @@ public class ConfigurationImpl implements Configuration, Serializable { @Override @Deprecated public ConfigurationImpl setWildcardRoutingEnabled(final boolean enabled) { - logger.info("Usage of wildcardRoutingEnabled configuration property is deprecated, please use wildCardConfiguration.routingEnabled instead"); + ActiveMQServerLogger.LOGGER.deprecatedWildcardRoutingEnabled(); wildcardConfiguration.setRoutingEnabled(enabled); return this; } @@ -1513,8 +1513,7 @@ public class ConfigurationImpl implements Configuration, Serializable { TransportConfiguration connector = getConnectorConfigurations().get(connectorName); if (connector == null) { - ActiveMQServerLogger.LOGGER.warn("bridgeNoConnector(connectorName)"); - + ActiveMQServerLogger.LOGGER.connectionConfigurationIsNull(connectorName == null ? "null" : connectorName); return null; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java index cd4f70a07a..25874f0d3a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java @@ -118,7 +118,7 @@ public class PagedReferenceImpl implements PagedReference { try { messageEstimate = getMessage().getMemoryEstimate(); } catch (Throwable e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.errorCalculateMessageMemoryEstimate(e); } } return messageEstimate; @@ -136,7 +136,7 @@ public class PagedReferenceImpl implements PagedReference { Message msg = getMessage(); return msg.getScheduledDeliveryTime(); } catch (Throwable e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.errorCalculateScheduledDeliveryTime(e); return 0L; } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java index c1e1761c40..2030d252a1 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java @@ -313,14 +313,14 @@ public class PageCursorProviderImpl implements PageCursorProvider { try { sub.onPageModeCleared(tx); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn("Error while cleaning paging on queue " + sub.getQueue().getName(), e); + ActiveMQServerLogger.LOGGER.errorCleaningPagingOnQueue(e, sub.getQueue().getName().toString()); } } try { tx.commit(); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn("Error while cleaning page, during the commit", e); + ActiveMQServerLogger.LOGGER.errorCleaningPagingDuringCommit(e); } } 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 fa2c748130..a674935a0b 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 @@ -725,7 +725,7 @@ final class PageSubscriptionImpl implements PageSubscription { try { store.deletePageComplete(completeInfo.getRecordID()); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn("Error while deleting page-complete-record", e); + ActiveMQServerLogger.LOGGER.errorDeletingPageCompleteRecord(e); } info.setCompleteInfo(null); } @@ -734,7 +734,7 @@ final class PageSubscriptionImpl implements PageSubscription { try { store.deleteCursorAcknowledge(deleteInfo.getRecordID()); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn("Error while deleting page-complete-record", e); + ActiveMQServerLogger.LOGGER.errorDeletingPageCompleteRecord(e); } } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java index f757f4bc46..1c5a4c3c5d 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java @@ -1437,12 +1437,12 @@ public abstract class AbstractJournalStorageManager extends CriticalComponentImp queueBindingEncoding.addQueueStatusEncoding(statusEncoding); } else { // unlikely to happen, so I didn't bother about the Logger method - logger.info("There is no queue with ID " + statusEncoding.queueID + ", deleting record " + statusEncoding.getId()); + ActiveMQServerLogger.LOGGER.infoNoQueueWithID(statusEncoding.queueID, statusEncoding.getId()); this.deleteQueueStatus(statusEncoding.getId()); } } else { // unlikely to happen - logger.warn("Invalid record type " + rec, new Exception("invalid record type " + rec)); + ActiveMQServerLogger.LOGGER.invalidRecordType(rec, new Exception("invalid record type " + rec)); } } 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 2341a66223..0bd4df3ad7 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 @@ -604,7 +604,7 @@ public class JournalStorageManager extends AbstractJournalStorageManager { storageManagerLock.writeLock().unlock(); } } catch (Exception e) { - logger.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToStartReplication(e); stopReplication(); throw e; } finally { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageImpl.java index b8236af4f8..0a2d3b29db 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageImpl.java @@ -439,7 +439,7 @@ public final class LargeServerMessageImpl extends CoreMessage implements LargeSe try { bodySize = file.size(); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToCalculateFileSize(e); } } return bodySize; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageInSync.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageInSync.java index 66ccd8c2bb..509f9d7dc2 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageInSync.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageInSync.java @@ -69,7 +69,7 @@ public final class LargeServerMessageInSync implements ReplicatedLargeMessage { } } } catch (Throwable e) { - logger.warn("Error while sincing data on largeMessageInSync::" + mainLM); + ActiveMQServerLogger.LOGGER.errorWhileSyncingData(mainLM.toString(), e); } if (logger.isTraceEnabled()) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java index e89dee0888..8f3c5bea88 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java @@ -819,7 +819,7 @@ public class ServerSessionPacketHandler implements ChannelHandler { ServerSession session) { session.markTXFailed(t); if (requiresResponse) { - ActiveMQServerLogger.LOGGER.warn("Sending unexpected exception to the client", t); + ActiveMQServerLogger.LOGGER.sendingUnexpectedExceptionToClient(t); ActiveMQException activeMQInternalErrorException = new ActiveMQInternalErrorException(); activeMQInternalErrorException.initCause(t); response = new ActiveMQExceptionMessage(activeMQInternalErrorException); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java index 8c2bee524c..a2fdeb0cdd 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java @@ -29,6 +29,7 @@ import org.apache.activemq.artemis.core.remoting.impl.AbstractAcceptor; import org.apache.activemq.artemis.core.security.ActiveMQPrincipal; import org.apache.activemq.artemis.core.server.ActiveMQComponent; import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle; +import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.cluster.ClusterConnection; import org.apache.activemq.artemis.core.server.management.Notification; import org.apache.activemq.artemis.core.server.management.NotificationService; @@ -170,7 +171,7 @@ public final class InVMAcceptor extends AbstractAcceptor { try { notificationService.sendNotification(notification); } catch (Exception e) { - logger.warn("failed to send notification", e.getMessage(), e); + ActiveMQServerLogger.LOGGER.failedToSendNotification(e); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java index 88881aa1af..6141d6cda9 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java @@ -613,7 +613,7 @@ public class NettyAcceptor extends AbstractAcceptor { try { notificationService.sendNotification(notification); } catch (Exception e) { - logger.warn("failed to send notification", e.getMessage(), e); + ActiveMQServerLogger.LOGGER.failedToSendNotification(e); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java index caccee3c75..94c776c40c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java @@ -714,7 +714,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif // failure detection could be affected conn.flush(); } catch (Throwable e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.failedToFlushOutstandingDataFromTheConnection(e); } } 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 1dbacc9299..36422720a0 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 @@ -402,7 +402,7 @@ public final class ReplicationManager implements ActiveMQComponent { OperationContext ctx = pendingTokens.poll(); if (ctx == null) { - logger.warn("Missing replication token on queue"); + ActiveMQServerLogger.LOGGER.missingReplicationTokenOnQueue(); return; } ctx.replicationDone(); 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 2ff784cca1..83ff12e798 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 @@ -31,6 +31,7 @@ package org.apache.activemq.artemis.core.server; * so an INFO message would be 101000 to 101999 */ +import javax.naming.NamingException; import javax.transaction.xa.Xid; import java.io.File; import java.net.SocketAddress; @@ -394,6 +395,38 @@ public interface ActiveMQServerLogger extends BasicLogger { @Message(id = 221071, value = "Failing over based on quorum vote results.", format = Message.Format.MESSAGE_FORMAT) void failingOverBasedOnQuorumVoteResults(); + @LogMessage(level = Logger.Level.INFO) + @Message(id = 221072, value = "Can't find roles for the subject.", format = Message.Format.MESSAGE_FORMAT) + void failedToFindRolesForTheSubject(@Cause Exception e); + + @LogMessage(level = Logger.Level.INFO) + @Message(id = 221073, value = "Can't add role principal.", format = Message.Format.MESSAGE_FORMAT) + void failedAddRolePrincipal(@Cause Exception e); + + @LogMessage(level = Logger.Level.INFO) + @Message(id = 221074, value = "Debug started : size = {0} bytes, messages = {1}", format = Message.Format.MESSAGE_FORMAT) + void debugStarted(Long globalSizeBytes, Long numberOfMessages); + + @LogMessage(level = Logger.Level.INFO) + @Message(id = 221075, value = "Usage of wildcardRoutingEnabled configuration property is deprecated, please use wildCardConfiguration.enabled instead", format = Message.Format.MESSAGE_FORMAT) + void deprecatedWildcardRoutingEnabled(); + + @LogMessage(level = Logger.Level.INFO) + @Message(id = 221076, value = "{0}", format = Message.Format.MESSAGE_FORMAT) + void onDestroyConnectionWithSessionMetadata(String msg); + + @LogMessage(level = Logger.Level.INFO) + @Message(id = 221077, value = "There is no queue with ID {0}, deleting record {1}", format = Message.Format.MESSAGE_FORMAT) + void infoNoQueueWithID(Long id, Long record); + + @LogMessage(level = Logger.Level.INFO) + @Message(id = 221078, value = "Scaled down {0} messages total.", format = Message.Format.MESSAGE_FORMAT) + void infoScaledDownMessages(Long num); + + @LogMessage(level = Logger.Level.INFO) + @Message(id = 221079, value = "Ignoring prepare on xid as already called : {0}", format = Message.Format.MESSAGE_FORMAT) + void ignoringPrepareOnXidAlreadyCalled(String xid); + @LogMessage(level = Logger.Level.WARN) @Message(id = 222000, value = "ActiveMQServer is being finalized and has not been stopped. Please remember to stop the server before letting it go out of scope", format = Message.Format.MESSAGE_FORMAT) @@ -425,9 +458,6 @@ public interface ActiveMQServerLogger extends BasicLogger { @LogMessage(level = Logger.Level.WARN) @Message(id = 222008, value = "unable to restart server, please kill and restart manually", format = Message.Format.MESSAGE_FORMAT) - void serverRestartWarning(); - - @LogMessage(level = Logger.Level.WARN) void serverRestartWarning(@Cause Exception e); @LogMessage(level = Logger.Level.WARN) @@ -1348,6 +1378,206 @@ public interface ActiveMQServerLogger extends BasicLogger { @Message(id = 222218, value = "Server disconnecting: {0}", format = Message.Format.MESSAGE_FORMAT) void disconnectCritical(String reason, @Cause Exception e); + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222219, value = "File {0} does not exist", + format = Message.Format.MESSAGE_FORMAT) + void fileDoesNotExist(String path); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222220, value = " Error while cleaning paging on queue {0}", format = Message.Format.MESSAGE_FORMAT) + void errorCleaningPagingOnQueue(@Cause Exception e, String queue); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222221, value = "Error while cleaning page, during the commit", format = Message.Format.MESSAGE_FORMAT) + void errorCleaningPagingDuringCommit(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222222, value = "Error while deleting page-complete-record", format = Message.Format.MESSAGE_FORMAT) + void errorDeletingPageCompleteRecord(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222223, value = "Failed to calculate message memory estimate", format = Message.Format.MESSAGE_FORMAT) + void errorCalculateMessageMemoryEstimate(@Cause Throwable e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222224, value = "Failed to calculate scheduled delivery time", format = Message.Format.MESSAGE_FORMAT) + void errorCalculateScheduledDeliveryTime(@Cause Throwable e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222225, value = "Sending unexpected exception to the client", format = Message.Format.MESSAGE_FORMAT) + void sendingUnexpectedExceptionToClient(@Cause Throwable e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222226, value = "Connection configuration is null for connectorName {0}", format = Message.Format.MESSAGE_FORMAT) + void connectionConfigurationIsNull(String connectorName); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222227, value = "Failed to process an event", format = Message.Format.MESSAGE_FORMAT) + void failedToProcessEvent(@Cause NamingException e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222228, value = "Missing replication token on queue", format = Message.Format.MESSAGE_FORMAT) + void missingReplicationTokenOnQueue(); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222229, value = "Failed to perform rollback", format = Message.Format.MESSAGE_FORMAT) + void failedToPerformRollback(@Cause IllegalStateException e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222230, value = "Failed to send notification", format = Message.Format.MESSAGE_FORMAT) + void failedToSendNotification(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222231, value = "Failed to flush outstanding data from the connection", format = Message.Format.MESSAGE_FORMAT) + void failedToFlushOutstandingDataFromTheConnection(@Cause Throwable e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222232, value = "Unable to acquire lock", format = Message.Format.MESSAGE_FORMAT) + void unableToAcquireLock(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222233, value = "Unable to destroy connection with session metadata", format = Message.Format.MESSAGE_FORMAT) + void unableDestroyConnectionWithSessionMetadata(@Cause Throwable e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222234, value = "Unable to deactivate a callback", format = Message.Format.MESSAGE_FORMAT) + void unableToDeactiveCallback(@Cause Throwable e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222235, value = "Unable to inject a monitor", format = Message.Format.MESSAGE_FORMAT) + void unableToInjectMonitor(@Cause Throwable e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222236, value = "Unable to flush deliveries", format = Message.Format.MESSAGE_FORMAT) + void unableToFlushDeliveries(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222237, value = "Unable to flush deliveries", format = Message.Format.MESSAGE_FORMAT) + void unableToCancelRedistributor(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222238, value = "Unable to commit transaction", format = Message.Format.MESSAGE_FORMAT) + void unableToCommitTransaction(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222239, value = "Unable to delete Queue status", format = Message.Format.MESSAGE_FORMAT) + void unableToDeleteQueueStatus(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222240, value = "Unable to pause a Queue", format = Message.Format.MESSAGE_FORMAT) + void unableToPauseQueue(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222241, value = "Unable to resume a Queue", format = Message.Format.MESSAGE_FORMAT) + void unableToResumeQueue(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222242, value = "Unable to obtain message priority, using default ", format = Message.Format.MESSAGE_FORMAT) + void unableToGetMessagePriority(@Cause Throwable e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222243, value = "Unable to extract GroupID from message", format = Message.Format.MESSAGE_FORMAT) + void unableToExtractGroupID(@Cause Throwable e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222244, value = "Unable to check if message expired", format = Message.Format.MESSAGE_FORMAT) + void unableToCheckIfMessageExpired(@Cause Throwable e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222245, value = "Unable to perform post acknowledge", format = Message.Format.MESSAGE_FORMAT) + void unableToPerformPostAcknowledge(@Cause Throwable e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222246, value = "Unable to rollback on close", format = Message.Format.MESSAGE_FORMAT) + void unableToRollbackOnClose(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222247, value = "Unable to close consumer", format = Message.Format.MESSAGE_FORMAT) + void unableToCloseConsumer(@Cause Throwable e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222248, value = "Unable to remove consumer", format = Message.Format.MESSAGE_FORMAT) + void unableToRemoveConsumer(@Cause Throwable e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222249, value = "Unable to rollback on TX timed out", format = Message.Format.MESSAGE_FORMAT) + void unableToRollbackOnTxTimedOut(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222250, value = "Unable to delete heuristic completion from storage manager", format = Message.Format.MESSAGE_FORMAT) + void unableToDeleteHeuristicCompletion(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222251, value = "Unable to start replication", format = Message.Format.MESSAGE_FORMAT) + void unableToStartReplication(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222252, value = "Unable to calculate file size", format = Message.Format.MESSAGE_FORMAT) + void unableToCalculateFileSize(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222253, value = "Error while syncing data on largeMessageInSync:: {0}", format = Message.Format.MESSAGE_FORMAT) + void errorWhileSyncingData(String target, @Cause Throwable e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222254, value = "Invalid record type {0}", format = Message.Format.MESSAGE_FORMAT) + void invalidRecordType(byte type, @Cause Throwable e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222255, value = "Unable to calculate file store usage", format = Message.Format.MESSAGE_FORMAT) + void unableToCalculateFileStoreUsage(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222256, value = "Failed to unregister acceptors", format = Message.Format.MESSAGE_FORMAT) + void failedToUnregisterAcceptors(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222257, value = "Failed to decrement message reference count", format = Message.Format.MESSAGE_FORMAT) + void failedToDecrementMessageReferenceCount(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222258, value = "Error on deleting queue {0}", format = Message.Format.MESSAGE_FORMAT) + void errorOnDeletingQueue(String queueName, @Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222259, value = "Failed to flush the executor", format = Message.Format.MESSAGE_FORMAT) + void failedToFlushExecutor(@Cause InterruptedException e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222260, value = "Failed to perform rollback", format = Message.Format.MESSAGE_FORMAT) + void failedToRollback(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222261, value = "Failed to activate a backup", format = Message.Format.MESSAGE_FORMAT) + void failedToActivateBackup(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222262, value = "Failed to stop cluster manager", format = Message.Format.MESSAGE_FORMAT) + void failedToStopClusterManager(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222263, value = "Failed to stop cluster connection", format = Message.Format.MESSAGE_FORMAT) + void failedToStopClusterConnection(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222264, value = "Failed to process message reference after rollback", format = Message.Format.MESSAGE_FORMAT) + void failedToProcessMessageReferenceAfterRollback(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222265, value = "Failed to finish delivery, unable to lock delivery", format = Message.Format.MESSAGE_FORMAT) + void failedToFinishDelivery(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222266, value = "Failed to send request to the node", format = Message.Format.MESSAGE_FORMAT) + void failedToSendRequestToNode(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222267, value = "Failed to disconnect bindings", format = Message.Format.MESSAGE_FORMAT) + void failedToDisconnectBindings(@Cause Exception e); + + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222268, value = "Failed to remove a record", format = Message.Format.MESSAGE_FORMAT) + void failedToRemoveRecord(@Cause Exception e); @LogMessage(level = Logger.Level.ERROR) @Message(id = 224000, value = "Failure in initialisation", format = Message.Format.MESSAGE_FORMAT) @@ -1654,4 +1884,28 @@ public interface ActiveMQServerLogger extends BasicLogger { @LogMessage(level = Logger.Level.WARN) @Message(id = 224078, value = "The size of duplicate cache detection () appears to be too large {0}. It should be no greater than the number of messages that can be squeezed into conformation buffer () {1}.", format = Message.Format.MESSAGE_FORMAT) void duplicateCacheSizeWarning(int idCacheSize, int confirmationWindowSize); + + @LogMessage(level = Logger.Level.ERROR) + @Message(id = 224082, value = "Failed to invoke an interceptor", format = Message.Format.MESSAGE_FORMAT) + void failedToInvokeAninterceptor(@Cause Exception e); + + @LogMessage(level = Logger.Level.ERROR) + @Message(id = 224083, value = "Failed to close context", format = Message.Format.MESSAGE_FORMAT) + void failedToCloseContext(@Cause Exception e); + + @LogMessage(level = Logger.Level.ERROR) + @Message(id = 224084, value = "Failed to open context", format = Message.Format.MESSAGE_FORMAT) + void failedToOpenContext(@Cause Exception e); + + @LogMessage(level = Logger.Level.ERROR) + @Message(id = 224085, value = "Failed to load property {0}, reason: {1}", format = Message.Format.MESSAGE_FORMAT) + void failedToLoadProperty(@Cause Exception e, String key, String reason); + + @LogMessage(level = Logger.Level.ERROR) + @Message(id = 224086, value = "Caught unexpected exception", format = Message.Format.MESSAGE_FORMAT) + void caughtUnexpectedException(@Cause NamingException e); + + @LogMessage(level = Logger.Level.ERROR) + @Message(id = 224087, value = "Error announcing backup: backupServerLocator is null. {0}", format = Message.Format.MESSAGE_FORMAT) + void errorAnnouncingBackup(String backupManager); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/BackupManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/BackupManager.java index e1c4175004..835cc1f0fd 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/BackupManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/BackupManager.java @@ -235,7 +235,7 @@ public class BackupManager implements ActiveMQComponent { ServerLocatorInternal localBackupLocator = backupServerLocator; if (localBackupLocator == null) { if (!stopping) - ActiveMQServerLogger.LOGGER.error("Error announcing backup: backupServerLocator is null. " + this); + ActiveMQServerLogger.LOGGER.errorAnnouncingBackup(this.toString()); return; } if (logger.isDebugEnabled()) { 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 8077b28659..4e8d77a776 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 @@ -510,7 +510,7 @@ public final class ClusterManager implements ActiveMQComponent { try { manager.stop(); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.failedToStopClusterManager(e); } } @@ -550,7 +550,7 @@ public final class ClusterManager implements ActiveMQComponent { try { clusterConnection.stop(); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.failedToStopClusterConnection(e); } } clearClusterConnections(); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedHAManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedHAManager.java index 627d59ab04..c9d9e1f8fd 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedHAManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedHAManager.java @@ -71,7 +71,7 @@ public class ColocatedHAManager implements HAManager { try { activeMQServer.stop(); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.errorStoppingServer(e); } } backupServers.clear(); 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 2f1fe870bb..bcfb58dd62 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 @@ -1484,7 +1484,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn record.close(); } } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e); + ActiveMQServerLogger.LOGGER.failedToRemoveRecord(e); } } @@ -1497,7 +1497,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn record.disconnectBindings(); } } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.failedToDisconnectBindings(e); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/Redistributor.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/Redistributor.java index eff8d67689..cfb9eeefae 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/Redistributor.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/Redistributor.java @@ -131,7 +131,7 @@ public class Redistributor implements Consumer { boolean ok = pendingRuns.await(10000); return ok; } catch (InterruptedException e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.failedToFlushExecutor(e); return false; } } @@ -181,9 +181,7 @@ public class Redistributor implements Consumer { tx.rollback(); } catch (Exception e2) { // Nothing much we can do now - - // TODO log - ActiveMQServerLogger.LOGGER.warn(e2.getMessage(), e2); + ActiveMQServerLogger.LOGGER.failedToRollback(e2); } } } 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 0663efe63b..0e3873281f 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 @@ -680,7 +680,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { try { activationLock.acquire(); } catch (Exception e) { - logger.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToAcquireLock(e); } } @@ -1306,7 +1306,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { sessions.remove(session.getName()); } } catch (Throwable e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableDestroyConnectionWithSessionMetadata(e); } } @@ -1319,7 +1319,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { return operationsExecuted.toString(); } finally { // This operation is critical for the knowledge of the admin, so we need to add info logs for later knowledge - ActiveMQServerLogger.LOGGER.info(operationsExecuted.toString()); + ActiveMQServerLogger.LOGGER.onDestroyConnectionWithSessionMetadata(operationsExecuted.toString()); } } @@ -2165,7 +2165,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { } catch (Throwable e) { // https://bugzilla.redhat.com/show_bug.cgi?id=1009530: // we won't interrupt the shutdown sequence because of a failed callback here - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToDeactiveCallback(e); } } } @@ -2410,7 +2410,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { try { injectMonitor(new FileStoreMonitor(getScheduledPool(), executorFactory.getExecutor(), configuration.getDiskScanPeriod(), TimeUnit.MILLISECONDS, configuration.getMaxDiskUsage() / 100f, shutdownOnCriticalIO)); } catch (Exception e) { - logger.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToInjectMonitor(e); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ColocatedActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ColocatedActivation.java index aa75775177..a125d821af 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ColocatedActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ColocatedActivation.java @@ -126,7 +126,7 @@ public class ColocatedActivation extends LiveActivation { try { started = colocatedHAManager.activateBackup(backupRequestMessage.getBackupSize(), backupRequestMessage.getJournalDirectory(), backupRequestMessage.getBindingsDirectory(), backupRequestMessage.getLargeMessagesDirectory(), backupRequestMessage.getPagingDirectory(), backupRequestMessage.getNodeID()); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.failedToActivateBackup(e); } channel.send(new BackupResponseMessage(started)); } else if (activationChannelHandler != null) { @@ -220,7 +220,7 @@ public class ColocatedActivation extends LiveActivation { }, colocatedPolicy.getBackupRequestRetryInterval(), TimeUnit.MILLISECONDS); } } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.failedToSendRequestToNode(e); } } else { nodes.clear(); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LegacyLDAPSecuritySettingPlugin.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LegacyLDAPSecuritySettingPlugin.java index 9c78c38063..6aa762ed31 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LegacyLDAPSecuritySettingPlugin.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LegacyLDAPSecuritySettingPlugin.java @@ -412,7 +412,7 @@ public class LegacyLDAPSecuritySettingPlugin implements SecuritySettingPlugin { } } } catch (NamingException e) { - logger.warn("Failed to process an event", e.getMessage(), e); + ActiveMQServerLogger.LOGGER.failedToProcessEvent(e); } } @@ -464,7 +464,7 @@ public class LegacyLDAPSecuritySettingPlugin implements SecuritySettingPlugin { } } } catch (NamingException e) { - logger.warn("Failed to process an event", e.getMessage(), e); + ActiveMQServerLogger.LOGGER.failedToProcessEvent(e); } } @@ -492,7 +492,7 @@ public class LegacyLDAPSecuritySettingPlugin implements SecuritySettingPlugin { */ public void namingExceptionThrown(NamingExceptionEvent namingExceptionEvent) { context = null; - ActiveMQServerLogger.LOGGER.error("Caught unexpected exception.", namingExceptionEvent.getException()); + ActiveMQServerLogger.LOGGER.caughtUnexpectedException(namingExceptionEvent.getException()); } protected class LDAPNamespaceChangeListener implements NamespaceChangeListener, ObjectChangeListener { 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 1f1f4fdd23..bd6b8aae7b 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 @@ -724,7 +724,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { return false; } } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToFlushDeliveries(e); return false; } } @@ -770,7 +770,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { cancelRedistributor(); } catch (Exception e) { // nothing that could be done anyway.. just logging - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToCancelRedistributor(e); } } }); @@ -1691,7 +1691,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { tx.commit(); } } catch (Exception e) { - logger.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToCommitTransaction(e); } // If empty we need to schedule depaging to make sure we would depage expired messages as well @@ -1923,7 +1923,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { try { storageManager.deleteQueueStatus(pauseStatusRecord); } catch (Exception e) { - logger.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToDeleteQueueStatus(e); } } this.pauseStatusRecord = recordID; @@ -1940,7 +1940,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { pauseStatusRecord = storageManager.storeQueueStatus(this.id, QueueStatus.PAUSED); } } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToPauseQueue(e); } paused = true; } @@ -1953,7 +1953,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { try { storageManager.deleteQueueStatus(pauseStatusRecord); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToResumeQueue(e); } pauseStatusRecord = -1; } @@ -2043,7 +2043,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { try { return ref.getMessage().getPriority(); } catch (Throwable e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToGetMessagePriority(e); return 4; // the default one in case of failure } } @@ -2274,7 +2274,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { // But we don't use the groupID on internal queues (clustered queues) otherwise the group map would leak forever return ref.getMessage().getGroupID(); } catch (Throwable e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToExtractGroupID(e); return null; } } @@ -2791,7 +2791,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { return false; } } catch (Throwable e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToCheckIfMessageExpired(e); return false; } } @@ -2844,7 +2844,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { try { message = ref.getMessage(); } catch (Throwable e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToPerformPostAcknowledge(e); message = null; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java index c5935d7eb8..6bf69ed888 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java @@ -129,7 +129,7 @@ public class RefsOperation extends TransactionOperationAbstract { } ackedTX.commit(true); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.failedToProcessMessageReferenceAfterRollback(e); } } } @@ -171,7 +171,7 @@ public class RefsOperation extends TransactionOperationAbstract { // This could happen on after commit, since the page could be deleted on file earlier by another thread logger.debug(e); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.failedToDecrementMessageReferenceCount(e); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java index e921cb9946..49117f3e74 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java @@ -94,7 +94,7 @@ public class ScaleDownHandler { ClusterControl clusterControl = clusterController.connectToNodeInCluster((ClientSessionFactoryInternal) sessionFactory); clusterControl.authorize(); long num = scaleDownMessages(sessionFactory, targetNodeId, clusterControl.getClusterUser(), clusterControl.getClusterPassword()); - ActiveMQServerLogger.LOGGER.info("Scaled down " + num + " messages total."); + ActiveMQServerLogger.LOGGER.infoScaledDownMessages(num); scaleDownTransactions(sessionFactory, resourceManager, clusterControl.getClusterUser(), clusterControl.getClusterPassword()); scaleDownDuplicateIDs(duplicateIDMap, sessionFactory, managementAddress, clusterControl.getClusterUser(), clusterControl.getClusterPassword()); clusterControl.announceScaleDown(new SimpleString(this.targetNodeId), nodeManager.getNodeId()); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java index 98015e19d7..edd15cec2a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java @@ -690,7 +690,7 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { } return true; } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.failedToFinishDelivery(e); return false; } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java index 4d28fc7738..fd96415592 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java @@ -365,7 +365,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { try { rollback(failed, false); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToRollbackOnClose(e); } } } @@ -378,11 +378,11 @@ public class ServerSessionImpl implements ServerSession, FailureListener { try { consumer.close(failed); } catch (Throwable e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToCloseConsumer(e); try { consumer.removeItself(); } catch (Throwable e2) { - ActiveMQServerLogger.LOGGER.warn(e2.getMessage(), e2); + ActiveMQServerLogger.LOGGER.unableToRemoveConsumer(e2); } } } @@ -998,7 +998,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { try { storageManager.deleteHeuristicCompletion(id); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToDeleteHeuristicCompletion(e); throw new ActiveMQXAException(XAException.XAER_RMFAIL); } } else { @@ -1078,7 +1078,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { // at this point we would be better on rolling back this session as a way to prevent consumers from holding their messages this.rollback(false); } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.unableToRollbackOnTxTimedOut(e); } throw new ActiveMQXAException(XAException.XAER_NOTA, "Cannot find xid in resource manager: " + xid); @@ -1200,7 +1200,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { if (theTx.getState() == Transaction.State.SUSPENDED) { throw new ActiveMQXAException(XAException.XAER_PROTO, "Cannot prepare transaction, it is suspended " + xid); } else if (theTx.getState() == Transaction.State.PREPARED) { - ActiveMQServerLogger.LOGGER.info("ignoring prepare on xid as already called :" + xid); + ActiveMQServerLogger.LOGGER.ignoringPrepareOnXidAlreadyCalled(xid.toString()); } else { theTx.prepare(); } @@ -1243,7 +1243,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { ActiveMQServerLogger.LOGGER.errorCompletingContext(new Exception("warning")); } } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); + ActiveMQServerLogger.LOGGER.errorCompletingContext(e); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java index a955f70af2..913cc7b1db 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java @@ -103,7 +103,7 @@ public final class SharedStoreBackupActivation extends Activation { activeMQServer.start(); } } catch (Exception e) { - ActiveMQServerLogger.LOGGER.serverRestartWarning(); + ActiveMQServerLogger.LOGGER.serverRestartWarning(e); } } }); @@ -227,8 +227,7 @@ public final class SharedStoreBackupActivation extends Activation { activeMQServer.start(); } } catch (Exception e) { - ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); - ActiveMQServerLogger.LOGGER.serverRestartWarning(); + ActiveMQServerLogger.LOGGER.serverRestartWarning(e); } } }); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/TransientQueueManagerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/TransientQueueManagerImpl.java index a8da6eb999..125c9fe762 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/TransientQueueManagerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/TransientQueueManagerImpl.java @@ -43,7 +43,7 @@ public class TransientQueueManagerImpl implements TransientQueueManager { try { server.destroyQueue(queueName, null, false); } catch (ActiveMQException e) { - ActiveMQServerLogger.LOGGER.warn("Error on deleting queue " + queueName + ", " + e.getMessage(), e); + ActiveMQServerLogger.LOGGER.errorOnDeletingQueue(queueName.toString(), e); } } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorRemovingTempQueue(e, queueName); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java index bb9fdb3494..e94e40b64f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java @@ -304,7 +304,7 @@ public class ManagementServiceImpl implements ManagementService { try { unregisterAcceptor(name); } catch (Exception e) { - logger.warn("Failed to unregister acceptors", e.getMessage(), e); + ActiveMQServerLogger.LOGGER.failedToUnregisterAcceptors(e); } } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/reload/ReloadManagerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/reload/ReloadManagerImpl.java index 8dfc3fe713..62ad093c38 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/reload/ReloadManagerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/reload/ReloadManagerImpl.java @@ -102,7 +102,7 @@ public class ReloadManagerImpl extends ActiveMQScheduledComponent implements Rel } if (!file.exists()) { - logger.warn("File " + file + " does not exist"); + ActiveMQServerLogger.LOGGER.fileDoesNotExist(file.toString()); } this.lastModified = file.lastModified(); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImpl.java index cc2fa22571..e3a0904740 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImpl.java @@ -378,7 +378,7 @@ public class TransactionImpl implements Transaction { } catch (IllegalStateException e) { // Something happened before and the TX didn't make to the Journal / Storage // We will like to execute afterRollback and clear anything pending - ActiveMQServerLogger.LOGGER.warn(e); + ActiveMQServerLogger.LOGGER.failedToPerformRollback(e); } // We want to make sure that nothing else gets done after the commit is issued // this will eliminate any possibility or races diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractProtocolManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractProtocolManager.java index b07a8bd19c..aaedecd532 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractProtocolManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractProtocolManager.java @@ -40,7 +40,7 @@ public abstract class AbstractProtocolManager, C break; } } catch (Exception e) { - ActiveMQServerLogger.LOGGER.error(e); + ActiveMQServerLogger.LOGGER.failedToInvokeAninterceptor(e); } } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQJAASSecurityManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQJAASSecurityManager.java index aaaec82bc3..1f4b5f3042 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQJAASSecurityManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/ActiveMQJAASSecurityManager.java @@ -29,6 +29,7 @@ import java.util.Set; import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration; import org.apache.activemq.artemis.core.security.CheckType; import org.apache.activemq.artemis.core.security.Role; +import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.spi.core.security.jaas.JaasCallbackHandler; import org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal; @@ -142,7 +143,7 @@ public class ActiveMQJAASSecurityManager implements ActiveMQSecurityManager3 { try { rolesForSubject.addAll(localSubject.getPrincipals(Class.forName(rolePrincipalClass).asSubclass(Principal.class))); } catch (Exception e) { - logger.info("Can't find roles for the subject", e); + ActiveMQServerLogger.LOGGER.failedToFindRolesForTheSubject(e); } if (rolesForSubject.size() > 0 && rolesWithPermission.size() > 0) { Iterator rolesForSubjectIter = rolesForSubject.iterator(); @@ -199,7 +200,7 @@ public class ActiveMQJAASSecurityManager implements ActiveMQSecurityManager3 { try { principals.add(createGroupPrincipal(role.getName(), rolePrincipalClass)); } catch (Exception e) { - logger.info("Can't add role principal", e); + ActiveMQServerLogger.LOGGER.failedAddRolePrincipal(e); } } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java index fa40edc40d..ee2c98059b 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java @@ -193,7 +193,7 @@ public class LDAPLoginModule implements LoginModule { context.close(); context = null; } catch (Exception e) { - ActiveMQServerLogger.LOGGER.error(e.toString()); + ActiveMQServerLogger.LOGGER.failedToCloseContext(e); } } } @@ -576,7 +576,7 @@ public class LDAPLoginModule implements LoginModule { } catch (NamingException e) { closeContext(); - ActiveMQServerLogger.LOGGER.error(e.toString()); + ActiveMQServerLogger.LOGGER.failedToOpenContext(e); throw e; } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/ReloadableProperties.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/ReloadableProperties.java index 66ba1a5b13..bed7d5f278 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/ReloadableProperties.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/ReloadableProperties.java @@ -57,7 +57,7 @@ public class ReloadableProperties { logger.debug("Load of: " + key); } } catch (IOException e) { - ActiveMQServerLogger.LOGGER.error("Failed to load: " + key + ", reason:" + e.getLocalizedMessage()); + ActiveMQServerLogger.LOGGER.failedToLoadProperty(e, key.toString(), e.getLocalizedMessage()); if (key.isDebug()) { logger.debug("Load of: " + key + ", failure exception" + e); }