Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ChannelMessages.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ChannelMessages.java?rev=1770576&r1=1770575&r2=1770576&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ChannelMessages.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ChannelMessages.java Sun Nov 20 16:42:57 2016 @@ -22,8 +22,8 @@ package org.apache.qpid.server.logging.m import static org.apache.qpid.server.logging.AbstractMessageLogger.DEFAULT_LOG_HIERARCHY_PREFIX; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import org.apache.qpid.server.logging.LogMessage; import java.text.MessageFormat; @@ -63,59 +63,109 @@ public class ChannelMessages } public static final String CHANNEL_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel"; - public static final String FLOW_ENFORCED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.flow_enforced"; public static final String CREATE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.create"; - public static final String FLOW_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.flow"; + public static final String FLOW_CONTROL_IGNORED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.flow_control_ignored"; public static final String CLOSE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.close"; + public static final String DISCARDMSG_NOROUTE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.discardmsg_noroute"; + public static final String DEADLETTERMSG_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.deadlettermsg"; + public static final String FLOW_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.flow"; public static final String PREFETCH_SIZE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.prefetch_size"; + public static final String OPEN_TXN_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.open_txn"; public static final String CLOSE_FORCED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.close_forced"; - public static final String LARGE_TRANSACTION_WARN_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.large_transaction_warn"; - public static final String DEADLETTERMSG_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.deadlettermsg"; - public static final String DISCARDMSG_NOALTEXCH_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.discardmsg_noaltexch"; + public static final String OPERATION_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.operation"; public static final String IDLE_TXN_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.idle_txn"; - public static final String FLOW_CONTROL_IGNORED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.flow_control_ignored"; - public static final String DISCARDMSG_NOROUTE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.discardmsg_noroute"; - public static final String OPEN_TXN_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.open_txn"; + public static final String FLOW_ENFORCED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.flow_enforced"; public static final String FLOW_REMOVED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.flow_removed"; + public static final String LARGE_TRANSACTION_WARN_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.large_transaction_warn"; + public static final String DISCARDMSG_NOALTEXCH_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.discardmsg_noaltexch"; static { LoggerFactory.getLogger(CHANNEL_LOG_HIERARCHY); - LoggerFactory.getLogger(FLOW_ENFORCED_LOG_HIERARCHY); LoggerFactory.getLogger(CREATE_LOG_HIERARCHY); - LoggerFactory.getLogger(FLOW_LOG_HIERARCHY); + LoggerFactory.getLogger(FLOW_CONTROL_IGNORED_LOG_HIERARCHY); LoggerFactory.getLogger(CLOSE_LOG_HIERARCHY); + LoggerFactory.getLogger(DISCARDMSG_NOROUTE_LOG_HIERARCHY); + LoggerFactory.getLogger(DEADLETTERMSG_LOG_HIERARCHY); + LoggerFactory.getLogger(FLOW_LOG_HIERARCHY); LoggerFactory.getLogger(PREFETCH_SIZE_LOG_HIERARCHY); + LoggerFactory.getLogger(OPEN_TXN_LOG_HIERARCHY); LoggerFactory.getLogger(CLOSE_FORCED_LOG_HIERARCHY); - LoggerFactory.getLogger(LARGE_TRANSACTION_WARN_LOG_HIERARCHY); - LoggerFactory.getLogger(DEADLETTERMSG_LOG_HIERARCHY); - LoggerFactory.getLogger(DISCARDMSG_NOALTEXCH_LOG_HIERARCHY); + LoggerFactory.getLogger(OPERATION_LOG_HIERARCHY); LoggerFactory.getLogger(IDLE_TXN_LOG_HIERARCHY); - LoggerFactory.getLogger(FLOW_CONTROL_IGNORED_LOG_HIERARCHY); - LoggerFactory.getLogger(DISCARDMSG_NOROUTE_LOG_HIERARCHY); - LoggerFactory.getLogger(OPEN_TXN_LOG_HIERARCHY); + LoggerFactory.getLogger(FLOW_ENFORCED_LOG_HIERARCHY); LoggerFactory.getLogger(FLOW_REMOVED_LOG_HIERARCHY); + LoggerFactory.getLogger(LARGE_TRANSACTION_WARN_LOG_HIERARCHY); + LoggerFactory.getLogger(DISCARDMSG_NOALTEXCH_LOG_HIERARCHY); _messages = ResourceBundle.getBundle("org.apache.qpid.server.logging.messages.Channel_logmessages", _currentLocale); } /** * Log a Channel message of the Format: - * <pre>CHN-1005 : Flow Control Enforced (Queue {0})</pre> + * <pre>CHN-1001 : Create</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage FLOW_ENFORCED(String param1) + public static LogMessage CREATE() { - String rawMessage = _messages.getString("FLOW_ENFORCED"); + String rawMessage = _messages.getString("CREATE"); - final Object[] messageArguments = {param1}; - // Create a new MessageFormat to ensure thread safety. - // Sharing a MessageFormat and using applyPattern is not thread safe - MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + final String message = rawMessage; - final String message = formatter.format(messageArguments); + return new LogMessage() + { + public String toString() + { + return message; + } + + public String getLogHierarchy() + { + return CREATE_LOG_HIERARCHY; + } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } + }; + } + + /** + * Log a Channel message of the Format: + * <pre>CHN-1012 : Flow Control Ignored. Channel will be closed.</pre> + * Optional values are contained in [square brackets] and are numbered + * sequentially in the method call. + * + */ + public static LogMessage FLOW_CONTROL_IGNORED() + { + String rawMessage = _messages.getString("FLOW_CONTROL_IGNORED"); + + final String message = rawMessage; return new LogMessage() { @@ -126,7 +176,7 @@ public class ChannelMessages public String getLogHierarchy() { - return FLOW_ENFORCED_LOG_HIERARCHY; + return FLOW_CONTROL_IGNORED_LOG_HIERARCHY; } @Override @@ -159,14 +209,14 @@ public class ChannelMessages /** * Log a Channel message of the Format: - * <pre>CHN-1001 : Create</pre> + * <pre>CHN-1003 : Close</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage CREATE() + public static LogMessage CLOSE() { - String rawMessage = _messages.getString("CREATE"); + String rawMessage = _messages.getString("CLOSE"); final String message = rawMessage; @@ -179,7 +229,7 @@ public class ChannelMessages public String getLogHierarchy() { - return CREATE_LOG_HIERARCHY; + return CLOSE_LOG_HIERARCHY; } @Override @@ -212,16 +262,16 @@ public class ChannelMessages /** * Log a Channel message of the Format: - * <pre>CHN-1002 : Flow {0}</pre> + * <pre>CHN-1010 : Discarded message : {0,number} as no binding on alternate exchange : {1}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage FLOW(String param1) + public static LogMessage DISCARDMSG_NOROUTE(Number param1, String param2) { - String rawMessage = _messages.getString("FLOW"); + String rawMessage = _messages.getString("DISCARDMSG_NOROUTE"); - final Object[] messageArguments = {param1}; + final Object[] messageArguments = {param1, param2}; // Create a new MessageFormat to ensure thread safety. // Sharing a MessageFormat and using applyPattern is not thread safe MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); @@ -237,7 +287,7 @@ public class ChannelMessages public String getLogHierarchy() { - return FLOW_LOG_HIERARCHY; + return DISCARDMSG_NOROUTE_LOG_HIERARCHY; } @Override @@ -270,16 +320,21 @@ public class ChannelMessages /** * Log a Channel message of the Format: - * <pre>CHN-1003 : Close</pre> + * <pre>CHN-1011 : Message : {0,number} moved to dead letter queue : {1}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage CLOSE() + public static LogMessage DEADLETTERMSG(Number param1, String param2) { - String rawMessage = _messages.getString("CLOSE"); + String rawMessage = _messages.getString("DEADLETTERMSG"); - final String message = rawMessage; + final Object[] messageArguments = {param1, param2}; + // Create a new MessageFormat to ensure thread safety. + // Sharing a MessageFormat and using applyPattern is not thread safe + MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + + final String message = formatter.format(messageArguments); return new LogMessage() { @@ -290,7 +345,7 @@ public class ChannelMessages public String getLogHierarchy() { - return CLOSE_LOG_HIERARCHY; + return DEADLETTERMSG_LOG_HIERARCHY; } @Override @@ -323,16 +378,16 @@ public class ChannelMessages /** * Log a Channel message of the Format: - * <pre>CHN-1004 : Prefetch Size (bytes) {0,number} : Count {1,number}</pre> + * <pre>CHN-1002 : Flow {0}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage PREFETCH_SIZE(Number param1, Number param2) + public static LogMessage FLOW(String param1) { - String rawMessage = _messages.getString("PREFETCH_SIZE"); + String rawMessage = _messages.getString("FLOW"); - final Object[] messageArguments = {param1, param2}; + final Object[] messageArguments = {param1}; // Create a new MessageFormat to ensure thread safety. // Sharing a MessageFormat and using applyPattern is not thread safe MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); @@ -348,7 +403,7 @@ public class ChannelMessages public String getLogHierarchy() { - return PREFETCH_SIZE_LOG_HIERARCHY; + return FLOW_LOG_HIERARCHY; } @Override @@ -381,14 +436,14 @@ public class ChannelMessages /** * Log a Channel message of the Format: - * <pre>CHN-1003 : Close : {0,number} - {1}</pre> + * <pre>CHN-1004 : Prefetch Size (bytes) {0,number} : Count {1,number}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage CLOSE_FORCED(Number param1, String param2) + public static LogMessage PREFETCH_SIZE(Number param1, Number param2) { - String rawMessage = _messages.getString("CLOSE_FORCED"); + String rawMessage = _messages.getString("PREFETCH_SIZE"); final Object[] messageArguments = {param1, param2}; // Create a new MessageFormat to ensure thread safety. @@ -406,7 +461,7 @@ public class ChannelMessages public String getLogHierarchy() { - return CLOSE_FORCED_LOG_HIERARCHY; + return PREFETCH_SIZE_LOG_HIERARCHY; } @Override @@ -439,14 +494,14 @@ public class ChannelMessages /** * Log a Channel message of the Format: - * <pre>CHN-1013 : Uncommitted transaction contains {0,number} bytes of incoming message data.</pre> + * <pre>CHN-1007 : Open Transaction : {0,number} ms</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage LARGE_TRANSACTION_WARN(Number param1) + public static LogMessage OPEN_TXN(Number param1) { - String rawMessage = _messages.getString("LARGE_TRANSACTION_WARN"); + String rawMessage = _messages.getString("OPEN_TXN"); final Object[] messageArguments = {param1}; // Create a new MessageFormat to ensure thread safety. @@ -464,7 +519,7 @@ public class ChannelMessages public String getLogHierarchy() { - return LARGE_TRANSACTION_WARN_LOG_HIERARCHY; + return OPEN_TXN_LOG_HIERARCHY; } @Override @@ -497,14 +552,14 @@ public class ChannelMessages /** * Log a Channel message of the Format: - * <pre>CHN-1011 : Message : {0,number} moved to dead letter queue : {1}</pre> + * <pre>CHN-1003 : Close : {0,number} - {1}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage DEADLETTERMSG(Number param1, String param2) + public static LogMessage CLOSE_FORCED(Number param1, String param2) { - String rawMessage = _messages.getString("DEADLETTERMSG"); + String rawMessage = _messages.getString("CLOSE_FORCED"); final Object[] messageArguments = {param1, param2}; // Create a new MessageFormat to ensure thread safety. @@ -522,7 +577,7 @@ public class ChannelMessages public String getLogHierarchy() { - return DEADLETTERMSG_LOG_HIERARCHY; + return CLOSE_FORCED_LOG_HIERARCHY; } @Override @@ -555,16 +610,16 @@ public class ChannelMessages /** * Log a Channel message of the Format: - * <pre>CHN-1009 : Discarded message : {0,number} as no alternate exchange configured for queue : {1} routing key : {2}</pre> + * <pre>CHN-1014 : Operation : {0}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage DISCARDMSG_NOALTEXCH(Number param1, String param2, String param3) + public static LogMessage OPERATION(String param1) { - String rawMessage = _messages.getString("DISCARDMSG_NOALTEXCH"); + String rawMessage = _messages.getString("OPERATION"); - final Object[] messageArguments = {param1, param2, param3}; + final Object[] messageArguments = {param1}; // Create a new MessageFormat to ensure thread safety. // Sharing a MessageFormat and using applyPattern is not thread safe MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); @@ -580,7 +635,7 @@ public class ChannelMessages public String getLogHierarchy() { - return DISCARDMSG_NOALTEXCH_LOG_HIERARCHY; + return OPERATION_LOG_HIERARCHY; } @Override @@ -671,16 +726,21 @@ public class ChannelMessages /** * Log a Channel message of the Format: - * <pre>CHN-1012 : Flow Control Ignored. Channel will be closed.</pre> + * <pre>CHN-1005 : Flow Control Enforced (Queue {0})</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage FLOW_CONTROL_IGNORED() + public static LogMessage FLOW_ENFORCED(String param1) { - String rawMessage = _messages.getString("FLOW_CONTROL_IGNORED"); + String rawMessage = _messages.getString("FLOW_ENFORCED"); - final String message = rawMessage; + final Object[] messageArguments = {param1}; + // Create a new MessageFormat to ensure thread safety. + // Sharing a MessageFormat and using applyPattern is not thread safe + MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + + final String message = formatter.format(messageArguments); return new LogMessage() { @@ -691,7 +751,7 @@ public class ChannelMessages public String getLogHierarchy() { - return FLOW_CONTROL_IGNORED_LOG_HIERARCHY; + return FLOW_ENFORCED_LOG_HIERARCHY; } @Override @@ -724,21 +784,16 @@ public class ChannelMessages /** * Log a Channel message of the Format: - * <pre>CHN-1010 : Discarded message : {0,number} as no binding on alternate exchange : {1}</pre> + * <pre>CHN-1006 : Flow Control Removed</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage DISCARDMSG_NOROUTE(Number param1, String param2) + public static LogMessage FLOW_REMOVED() { - String rawMessage = _messages.getString("DISCARDMSG_NOROUTE"); - - final Object[] messageArguments = {param1, param2}; - // Create a new MessageFormat to ensure thread safety. - // Sharing a MessageFormat and using applyPattern is not thread safe - MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + String rawMessage = _messages.getString("FLOW_REMOVED"); - final String message = formatter.format(messageArguments); + final String message = rawMessage; return new LogMessage() { @@ -749,7 +804,7 @@ public class ChannelMessages public String getLogHierarchy() { - return DISCARDMSG_NOROUTE_LOG_HIERARCHY; + return FLOW_REMOVED_LOG_HIERARCHY; } @Override @@ -782,14 +837,14 @@ public class ChannelMessages /** * Log a Channel message of the Format: - * <pre>CHN-1007 : Open Transaction : {0,number} ms</pre> + * <pre>CHN-1013 : Uncommitted transaction contains {0,number} bytes of incoming message data.</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage OPEN_TXN(Number param1) + public static LogMessage LARGE_TRANSACTION_WARN(Number param1) { - String rawMessage = _messages.getString("OPEN_TXN"); + String rawMessage = _messages.getString("LARGE_TRANSACTION_WARN"); final Object[] messageArguments = {param1}; // Create a new MessageFormat to ensure thread safety. @@ -807,7 +862,7 @@ public class ChannelMessages public String getLogHierarchy() { - return OPEN_TXN_LOG_HIERARCHY; + return LARGE_TRANSACTION_WARN_LOG_HIERARCHY; } @Override @@ -840,16 +895,21 @@ public class ChannelMessages /** * Log a Channel message of the Format: - * <pre>CHN-1006 : Flow Control Removed</pre> + * <pre>CHN-1009 : Discarded message : {0,number} as no alternate exchange configured for queue : {1} routing key : {2}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage FLOW_REMOVED() + public static LogMessage DISCARDMSG_NOALTEXCH(Number param1, String param2, String param3) { - String rawMessage = _messages.getString("FLOW_REMOVED"); + String rawMessage = _messages.getString("DISCARDMSG_NOALTEXCH"); - final String message = rawMessage; + final Object[] messageArguments = {param1, param2, param3}; + // Create a new MessageFormat to ensure thread safety. + // Sharing a MessageFormat and using applyPattern is not thread safe + MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + + final String message = formatter.format(messageArguments); return new LogMessage() { @@ -860,7 +920,7 @@ public class ChannelMessages public String getLogHierarchy() { - return FLOW_REMOVED_LOG_HIERARCHY; + return DISCARDMSG_NOALTEXCH_LOG_HIERARCHY; } @Override
Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Channel_logmessages.properties URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Channel_logmessages.properties?rev=1770576&r1=1770575&r2=1770576&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Channel_logmessages.properties (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Channel_logmessages.properties Sun Nov 20 16:42:57 2016 @@ -43,3 +43,5 @@ FLOW_CONTROL_IGNORED = CHN-1012 : Flow C LARGE_TRANSACTION_WARN = CHN-1013 : Uncommitted transaction contains {0,number} bytes of incoming message data. +# 0 - operation name +OPERATION = CHN-1014 : Operation : {0} Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConfigStoreMessages.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConfigStoreMessages.java?rev=1770576&r1=1770575&r2=1770576&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConfigStoreMessages.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConfigStoreMessages.java Sun Nov 20 16:42:57 2016 @@ -22,8 +22,8 @@ package org.apache.qpid.server.logging.m import static org.apache.qpid.server.logging.AbstractMessageLogger.DEFAULT_LOG_HIERARCHY_PREFIX; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import org.apache.qpid.server.logging.LogMessage; import java.text.MessageFormat; @@ -63,34 +63,34 @@ public class ConfigStoreMessages } public static final String CONFIGSTORE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "configstore"; - public static final String RECOVERY_COMPLETE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "configstore.recovery_complete"; - public static final String CLOSE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "configstore.close"; + public static final String RECOVERY_START_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "configstore.recovery_start"; public static final String CREATED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "configstore.created"; public static final String STORE_LOCATION_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "configstore.store_location"; - public static final String RECOVERY_START_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "configstore.recovery_start"; + public static final String CLOSE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "configstore.close"; + public static final String RECOVERY_COMPLETE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "configstore.recovery_complete"; static { LoggerFactory.getLogger(CONFIGSTORE_LOG_HIERARCHY); - LoggerFactory.getLogger(RECOVERY_COMPLETE_LOG_HIERARCHY); - LoggerFactory.getLogger(CLOSE_LOG_HIERARCHY); + LoggerFactory.getLogger(RECOVERY_START_LOG_HIERARCHY); LoggerFactory.getLogger(CREATED_LOG_HIERARCHY); LoggerFactory.getLogger(STORE_LOCATION_LOG_HIERARCHY); - LoggerFactory.getLogger(RECOVERY_START_LOG_HIERARCHY); + LoggerFactory.getLogger(CLOSE_LOG_HIERARCHY); + LoggerFactory.getLogger(RECOVERY_COMPLETE_LOG_HIERARCHY); _messages = ResourceBundle.getBundle("org.apache.qpid.server.logging.messages.ConfigStore_logmessages", _currentLocale); } /** * Log a ConfigStore message of the Format: - * <pre>CFG-1005 : Recovery Complete</pre> + * <pre>CFG-1004 : Recovery Start</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage RECOVERY_COMPLETE() + public static LogMessage RECOVERY_START() { - String rawMessage = _messages.getString("RECOVERY_COMPLETE"); + String rawMessage = _messages.getString("RECOVERY_START"); final String message = rawMessage; @@ -103,7 +103,7 @@ public class ConfigStoreMessages public String getLogHierarchy() { - return RECOVERY_COMPLETE_LOG_HIERARCHY; + return RECOVERY_START_LOG_HIERARCHY; } @Override @@ -136,14 +136,14 @@ public class ConfigStoreMessages /** * Log a ConfigStore message of the Format: - * <pre>CFG-1003 : Closed</pre> + * <pre>CFG-1001 : Created</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage CLOSE() + public static LogMessage CREATED() { - String rawMessage = _messages.getString("CLOSE"); + String rawMessage = _messages.getString("CREATED"); final String message = rawMessage; @@ -156,7 +156,7 @@ public class ConfigStoreMessages public String getLogHierarchy() { - return CLOSE_LOG_HIERARCHY; + return CREATED_LOG_HIERARCHY; } @Override @@ -189,16 +189,21 @@ public class ConfigStoreMessages /** * Log a ConfigStore message of the Format: - * <pre>CFG-1001 : Created</pre> + * <pre>CFG-1002 : Store location : {0}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage CREATED() + public static LogMessage STORE_LOCATION(String param1) { - String rawMessage = _messages.getString("CREATED"); + String rawMessage = _messages.getString("STORE_LOCATION"); - final String message = rawMessage; + final Object[] messageArguments = {param1}; + // Create a new MessageFormat to ensure thread safety. + // Sharing a MessageFormat and using applyPattern is not thread safe + MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + + final String message = formatter.format(messageArguments); return new LogMessage() { @@ -209,7 +214,7 @@ public class ConfigStoreMessages public String getLogHierarchy() { - return CREATED_LOG_HIERARCHY; + return STORE_LOCATION_LOG_HIERARCHY; } @Override @@ -242,21 +247,16 @@ public class ConfigStoreMessages /** * Log a ConfigStore message of the Format: - * <pre>CFG-1002 : Store location : {0}</pre> + * <pre>CFG-1003 : Closed</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage STORE_LOCATION(String param1) + public static LogMessage CLOSE() { - String rawMessage = _messages.getString("STORE_LOCATION"); - - final Object[] messageArguments = {param1}; - // Create a new MessageFormat to ensure thread safety. - // Sharing a MessageFormat and using applyPattern is not thread safe - MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + String rawMessage = _messages.getString("CLOSE"); - final String message = formatter.format(messageArguments); + final String message = rawMessage; return new LogMessage() { @@ -267,7 +267,7 @@ public class ConfigStoreMessages public String getLogHierarchy() { - return STORE_LOCATION_LOG_HIERARCHY; + return CLOSE_LOG_HIERARCHY; } @Override @@ -300,14 +300,14 @@ public class ConfigStoreMessages /** * Log a ConfigStore message of the Format: - * <pre>CFG-1004 : Recovery Start</pre> + * <pre>CFG-1005 : Recovery Complete</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage RECOVERY_START() + public static LogMessage RECOVERY_COMPLETE() { - String rawMessage = _messages.getString("RECOVERY_START"); + String rawMessage = _messages.getString("RECOVERY_COMPLETE"); final String message = rawMessage; @@ -320,7 +320,7 @@ public class ConfigStoreMessages public String getLogHierarchy() { - return RECOVERY_START_LOG_HIERARCHY; + return RECOVERY_COMPLETE_LOG_HIERARCHY; } @Override Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConnectionMessages.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConnectionMessages.java?rev=1770576&r1=1770575&r2=1770576&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConnectionMessages.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConnectionMessages.java Sun Nov 20 16:42:57 2016 @@ -22,8 +22,8 @@ package org.apache.qpid.server.logging.m import static org.apache.qpid.server.logging.AbstractMessageLogger.DEFAULT_LOG_HIERARCHY_PREFIX; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import org.apache.qpid.server.logging.LogMessage; import java.text.MessageFormat; @@ -63,93 +63,100 @@ public class ConnectionMessages } public static final String CONNECTION_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection"; - public static final String OPEN_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.open"; - public static final String DROPPED_CONNECTION_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.dropped_connection"; - public static final String CLIENT_VERSION_REJECT_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.client_version_reject"; + public static final String OPERATION_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.operation"; public static final String CLIENT_VERSION_LOG_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.client_version_log"; + public static final String CLIENT_VERSION_REJECT_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.client_version_reject"; + public static final String DROPPED_CONNECTION_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.dropped_connection"; + public static final String MODEL_DELETE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.model_delete"; public static final String IDLE_CLOSE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.idle_close"; public static final String CLOSE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.close"; - public static final String MODEL_DELETE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.model_delete"; + public static final String OPEN_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.open"; static { LoggerFactory.getLogger(CONNECTION_LOG_HIERARCHY); - LoggerFactory.getLogger(OPEN_LOG_HIERARCHY); - LoggerFactory.getLogger(DROPPED_CONNECTION_LOG_HIERARCHY); - LoggerFactory.getLogger(CLIENT_VERSION_REJECT_LOG_HIERARCHY); + LoggerFactory.getLogger(OPERATION_LOG_HIERARCHY); LoggerFactory.getLogger(CLIENT_VERSION_LOG_LOG_HIERARCHY); + LoggerFactory.getLogger(CLIENT_VERSION_REJECT_LOG_HIERARCHY); + LoggerFactory.getLogger(DROPPED_CONNECTION_LOG_HIERARCHY); + LoggerFactory.getLogger(MODEL_DELETE_LOG_HIERARCHY); LoggerFactory.getLogger(IDLE_CLOSE_LOG_HIERARCHY); LoggerFactory.getLogger(CLOSE_LOG_HIERARCHY); - LoggerFactory.getLogger(MODEL_DELETE_LOG_HIERARCHY); + LoggerFactory.getLogger(OPEN_LOG_HIERARCHY); _messages = ResourceBundle.getBundle("org.apache.qpid.server.logging.messages.Connection_logmessages", _currentLocale); } /** * Log a Connection message of the Format: - * <pre>CON-1001 : Open : Destination : {0}({1}) : Protocol Version : {2}[ : SSL][ : Client ID : {3}][ : Client Version : {4}][ : Client Product : {5}]</pre> + * <pre>CON-1008 : Operation : {0}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage OPEN(String param1, String param2, String param3, String param4, String param5, String param6, boolean opt1, boolean opt2, boolean opt3, boolean opt4) + public static LogMessage OPERATION(String param1) { - String rawMessage = _messages.getString("OPEN"); - StringBuffer msg = new StringBuffer(); + String rawMessage = _messages.getString("OPERATION"); - // Split the formatted message up on the option values so we can - // rebuild the message based on the configured options. - String[] parts = rawMessage.split("\\["); - msg.append(parts[0]); + final Object[] messageArguments = {param1}; + // Create a new MessageFormat to ensure thread safety. + // Sharing a MessageFormat and using applyPattern is not thread safe + MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); - int end; - if (parts.length > 1) - { + final String message = formatter.format(messageArguments); - // Add Option : : SSL. - end = parts[1].indexOf(']'); - if (opt1) + return new LogMessage() + { + public String toString() { - msg.append(parts[1].substring(0, end)); + return message; } - // Use 'end + 1' to remove the ']' from the output - msg.append(parts[1].substring(end + 1)); - - // Add Option : : Client ID : {3}. - end = parts[2].indexOf(']'); - if (opt2) + public String getLogHierarchy() { - msg.append(parts[2].substring(0, end)); + return OPERATION_LOG_HIERARCHY; } - // Use 'end + 1' to remove the ']' from the output - msg.append(parts[2].substring(end + 1)); - - // Add Option : : Client Version : {4}. - end = parts[3].indexOf(']'); - if (opt3) + @Override + public boolean equals(final Object o) { - msg.append(parts[3].substring(0, end)); - } + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } - // Use 'end + 1' to remove the ']' from the output - msg.append(parts[3].substring(end + 1)); + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); - // Add Option : : Client Product : {5}. - end = parts[4].indexOf(']'); - if (opt4) - { - msg.append(parts[4].substring(0, end)); } - // Use 'end + 1' to remove the ']' from the output - msg.append(parts[4].substring(end + 1)); - } + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } + }; + } - rawMessage = msg.toString(); + /** + * Log a Connection message of the Format: + * <pre>CON-1005 : Client version "{0}" logged by validation</pre> + * Optional values are contained in [square brackets] and are numbered + * sequentially in the method call. + * + */ + public static LogMessage CLIENT_VERSION_LOG(String param1) + { + String rawMessage = _messages.getString("CLIENT_VERSION_LOG"); - final Object[] messageArguments = {param1, param2, param3, param4, param5, param6}; + final Object[] messageArguments = {param1}; // Create a new MessageFormat to ensure thread safety. // Sharing a MessageFormat and using applyPattern is not thread safe MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); @@ -165,7 +172,7 @@ public class ConnectionMessages public String getLogHierarchy() { - return OPEN_LOG_HIERARCHY; + return CLIENT_VERSION_LOG_LOG_HIERARCHY; } @Override @@ -198,16 +205,21 @@ public class ConnectionMessages /** * Log a Connection message of the Format: - * <pre>CON-1004 : Connection dropped</pre> + * <pre>CON-1006 : Client version "{0}" rejected by validation</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage DROPPED_CONNECTION() + public static LogMessage CLIENT_VERSION_REJECT(String param1) { - String rawMessage = _messages.getString("DROPPED_CONNECTION"); + String rawMessage = _messages.getString("CLIENT_VERSION_REJECT"); - final String message = rawMessage; + final Object[] messageArguments = {param1}; + // Create a new MessageFormat to ensure thread safety. + // Sharing a MessageFormat and using applyPattern is not thread safe + MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + + final String message = formatter.format(messageArguments); return new LogMessage() { @@ -218,7 +230,7 @@ public class ConnectionMessages public String getLogHierarchy() { - return DROPPED_CONNECTION_LOG_HIERARCHY; + return CLIENT_VERSION_REJECT_LOG_HIERARCHY; } @Override @@ -251,21 +263,16 @@ public class ConnectionMessages /** * Log a Connection message of the Format: - * <pre>CON-1006 : Client version "{0}" rejected by validation</pre> + * <pre>CON-1004 : Connection dropped</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage CLIENT_VERSION_REJECT(String param1) + public static LogMessage DROPPED_CONNECTION() { - String rawMessage = _messages.getString("CLIENT_VERSION_REJECT"); - - final Object[] messageArguments = {param1}; - // Create a new MessageFormat to ensure thread safety. - // Sharing a MessageFormat and using applyPattern is not thread safe - MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + String rawMessage = _messages.getString("DROPPED_CONNECTION"); - final String message = formatter.format(messageArguments); + final String message = rawMessage; return new LogMessage() { @@ -276,7 +283,7 @@ public class ConnectionMessages public String getLogHierarchy() { - return CLIENT_VERSION_REJECT_LOG_HIERARCHY; + return DROPPED_CONNECTION_LOG_HIERARCHY; } @Override @@ -309,21 +316,16 @@ public class ConnectionMessages /** * Log a Connection message of the Format: - * <pre>CON-1005 : Client version "{0}" logged by validation</pre> + * <pre>CON-1007 : Connection close initiated by operator</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage CLIENT_VERSION_LOG(String param1) + public static LogMessage MODEL_DELETE() { - String rawMessage = _messages.getString("CLIENT_VERSION_LOG"); - - final Object[] messageArguments = {param1}; - // Create a new MessageFormat to ensure thread safety. - // Sharing a MessageFormat and using applyPattern is not thread safe - MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + String rawMessage = _messages.getString("MODEL_DELETE"); - final String message = formatter.format(messageArguments); + final String message = rawMessage; return new LogMessage() { @@ -334,7 +336,7 @@ public class ConnectionMessages public String getLogHierarchy() { - return CLIENT_VERSION_LOG_LOG_HIERARCHY; + return MODEL_DELETE_LOG_HIERARCHY; } @Override @@ -501,16 +503,74 @@ public class ConnectionMessages /** * Log a Connection message of the Format: - * <pre>CON-1007 : Connection close initiated by operator</pre> + * <pre>CON-1001 : Open : Destination : {0}({1}) : Protocol Version : {2}[ : SSL][ : Client ID : {3}][ : Client Version : {4}][ : Client Product : {5}]</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage MODEL_DELETE() + public static LogMessage OPEN(String param1, String param2, String param3, String param4, String param5, String param6, boolean opt1, boolean opt2, boolean opt3, boolean opt4) { - String rawMessage = _messages.getString("MODEL_DELETE"); + String rawMessage = _messages.getString("OPEN"); + StringBuffer msg = new StringBuffer(); - final String message = rawMessage; + // Split the formatted message up on the option values so we can + // rebuild the message based on the configured options. + String[] parts = rawMessage.split("\\["); + msg.append(parts[0]); + + int end; + if (parts.length > 1) + { + + // Add Option : : SSL. + end = parts[1].indexOf(']'); + if (opt1) + { + msg.append(parts[1].substring(0, end)); + } + + // Use 'end + 1' to remove the ']' from the output + msg.append(parts[1].substring(end + 1)); + + // Add Option : : Client ID : {3}. + end = parts[2].indexOf(']'); + if (opt2) + { + msg.append(parts[2].substring(0, end)); + } + + // Use 'end + 1' to remove the ']' from the output + msg.append(parts[2].substring(end + 1)); + + // Add Option : : Client Version : {4}. + end = parts[3].indexOf(']'); + if (opt3) + { + msg.append(parts[3].substring(0, end)); + } + + // Use 'end + 1' to remove the ']' from the output + msg.append(parts[3].substring(end + 1)); + + // Add Option : : Client Product : {5}. + end = parts[4].indexOf(']'); + if (opt4) + { + msg.append(parts[4].substring(0, end)); + } + + // Use 'end + 1' to remove the ']' from the output + msg.append(parts[4].substring(end + 1)); + } + + rawMessage = msg.toString(); + + final Object[] messageArguments = {param1, param2, param3, param4, param5, param6}; + // Create a new MessageFormat to ensure thread safety. + // Sharing a MessageFormat and using applyPattern is not thread safe + MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + + final String message = formatter.format(messageArguments); return new LogMessage() { @@ -521,7 +581,7 @@ public class ConnectionMessages public String getLogHierarchy() { - return MODEL_DELETE_LOG_HIERARCHY; + return OPEN_LOG_HIERARCHY; } @Override Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Connection_logmessages.properties URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Connection_logmessages.properties?rev=1770576&r1=1770575&r2=1770576&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Connection_logmessages.properties (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Connection_logmessages.properties Sun Nov 20 16:42:57 2016 @@ -25,3 +25,5 @@ DROPPED_CONNECTION = CON-1004 : Connecti CLIENT_VERSION_LOG = CON-1005 : Client version "{0}" logged by validation CLIENT_VERSION_REJECT = CON-1006 : Client version "{0}" rejected by validation MODEL_DELETE = CON-1007 : Connection close initiated by operator +# 0 - operation name +OPERATION = CON-1008 : Operation : {0} Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ExchangeMessages.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ExchangeMessages.java?rev=1770576&r1=1770575&r2=1770576&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ExchangeMessages.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ExchangeMessages.java Sun Nov 20 16:42:57 2016 @@ -22,8 +22,8 @@ package org.apache.qpid.server.logging.m import static org.apache.qpid.server.logging.AbstractMessageLogger.DEFAULT_LOG_HIERARCHY_PREFIX; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import org.apache.qpid.server.logging.LogMessage; import java.text.MessageFormat; @@ -63,30 +63,55 @@ public class ExchangeMessages } public static final String EXCHANGE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "exchange"; - public static final String DISCARDMSG_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "exchange.discardmsg"; public static final String CREATED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "exchange.created"; public static final String DELETED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "exchange.deleted"; + public static final String DISCARDMSG_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "exchange.discardmsg"; + public static final String OPERATION_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "exchange.operation"; static { LoggerFactory.getLogger(EXCHANGE_LOG_HIERARCHY); - LoggerFactory.getLogger(DISCARDMSG_LOG_HIERARCHY); LoggerFactory.getLogger(CREATED_LOG_HIERARCHY); LoggerFactory.getLogger(DELETED_LOG_HIERARCHY); + LoggerFactory.getLogger(DISCARDMSG_LOG_HIERARCHY); + LoggerFactory.getLogger(OPERATION_LOG_HIERARCHY); _messages = ResourceBundle.getBundle("org.apache.qpid.server.logging.messages.Exchange_logmessages", _currentLocale); } /** * Log a Exchange message of the Format: - * <pre>EXH-1003 : Discarded Message : Name: "{0}" Routing Key: "{1}"</pre> + * <pre>EXH-1001 : Create :[ Durable] Type: {0} Name: {1}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage DISCARDMSG(String param1, String param2) + public static LogMessage CREATED(String param1, String param2, boolean opt1) { - String rawMessage = _messages.getString("DISCARDMSG"); + String rawMessage = _messages.getString("CREATED"); + StringBuffer msg = new StringBuffer(); + + // Split the formatted message up on the option values so we can + // rebuild the message based on the configured options. + String[] parts = rawMessage.split("\\["); + msg.append(parts[0]); + + int end; + if (parts.length > 1) + { + + // Add Option : Durable. + end = parts[1].indexOf(']'); + if (opt1) + { + msg.append(parts[1].substring(0, end)); + } + + // Use 'end + 1' to remove the ']' from the output + msg.append(parts[1].substring(end + 1)); + } + + rawMessage = msg.toString(); final Object[] messageArguments = {param1, param2}; // Create a new MessageFormat to ensure thread safety. @@ -104,7 +129,7 @@ public class ExchangeMessages public String getLogHierarchy() { - return DISCARDMSG_LOG_HIERARCHY; + return CREATED_LOG_HIERARCHY; } @Override @@ -137,37 +162,67 @@ public class ExchangeMessages /** * Log a Exchange message of the Format: - * <pre>EXH-1001 : Create :[ Durable] Type: {0} Name: {1}</pre> + * <pre>EXH-1002 : Deleted</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage CREATED(String param1, String param2, boolean opt1) + public static LogMessage DELETED() { - String rawMessage = _messages.getString("CREATED"); - StringBuffer msg = new StringBuffer(); + String rawMessage = _messages.getString("DELETED"); - // Split the formatted message up on the option values so we can - // rebuild the message based on the configured options. - String[] parts = rawMessage.split("\\["); - msg.append(parts[0]); + final String message = rawMessage; - int end; - if (parts.length > 1) + return new LogMessage() { + public String toString() + { + return message; + } - // Add Option : Durable. - end = parts[1].indexOf(']'); - if (opt1) + public String getLogHierarchy() { - msg.append(parts[1].substring(0, end)); + return DELETED_LOG_HIERARCHY; } - // Use 'end + 1' to remove the ']' from the output - msg.append(parts[1].substring(end + 1)); - } + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } - rawMessage = msg.toString(); + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } + }; + } + + /** + * Log a Exchange message of the Format: + * <pre>EXH-1003 : Discarded Message : Name: "{0}" Routing Key: "{1}"</pre> + * Optional values are contained in [square brackets] and are numbered + * sequentially in the method call. + * + */ + public static LogMessage DISCARDMSG(String param1, String param2) + { + String rawMessage = _messages.getString("DISCARDMSG"); final Object[] messageArguments = {param1, param2}; // Create a new MessageFormat to ensure thread safety. @@ -185,7 +240,7 @@ public class ExchangeMessages public String getLogHierarchy() { - return CREATED_LOG_HIERARCHY; + return DISCARDMSG_LOG_HIERARCHY; } @Override @@ -218,16 +273,21 @@ public class ExchangeMessages /** * Log a Exchange message of the Format: - * <pre>EXH-1002 : Deleted</pre> + * <pre>EXH-1004 : Operation : {0}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage DELETED() + public static LogMessage OPERATION(String param1) { - String rawMessage = _messages.getString("DELETED"); + String rawMessage = _messages.getString("OPERATION"); - final String message = rawMessage; + final Object[] messageArguments = {param1}; + // Create a new MessageFormat to ensure thread safety. + // Sharing a MessageFormat and using applyPattern is not thread safe + MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + + final String message = formatter.format(messageArguments); return new LogMessage() { @@ -238,7 +298,7 @@ public class ExchangeMessages public String getLogHierarchy() { - return DELETED_LOG_HIERARCHY; + return OPERATION_LOG_HIERARCHY; } @Override Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Exchange_logmessages.properties URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Exchange_logmessages.properties?rev=1770576&r1=1770575&r2=1770576&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Exchange_logmessages.properties (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Exchange_logmessages.properties Sun Nov 20 16:42:57 2016 @@ -23,3 +23,5 @@ CREATED = EXH-1001 : Create :[ Durable] Type: {0} Name: {1} DELETED = EXH-1002 : Deleted DISCARDMSG = EXH-1003 : Discarded Message : Name: "{0}" Routing Key: "{1}" +# 0 - operation name +OPERATION = EXH-1004 : Operation : {0} Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailabilityMessages.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailabilityMessages.java?rev=1770576&r1=1770575&r2=1770576&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailabilityMessages.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailabilityMessages.java Sun Nov 20 16:42:57 2016 @@ -22,8 +22,8 @@ package org.apache.qpid.server.logging.m import static org.apache.qpid.server.logging.AbstractMessageLogger.DEFAULT_LOG_HIERARCHY_PREFIX; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import org.apache.qpid.server.logging.LogMessage; import java.text.MessageFormat; @@ -63,52 +63,52 @@ public class HighAvailabilityMessages } public static final String HIGHAVAILABILITY_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability"; - public static final String INTRUDER_DETECTED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.intruder_detected"; - public static final String TRANSFER_MASTER_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.transfer_master"; - public static final String QUORUM_OVERRIDE_CHANGED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.quorum_override_changed"; - public static final String REMOVED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.removed"; public static final String LEFT_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.left"; - public static final String JOINED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.joined"; - public static final String CREATED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.created"; - public static final String QUORUM_LOST_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.quorum_lost"; public static final String PRIORITY_CHANGED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.priority_changed"; - public static final String ADDED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.added"; - public static final String DELETED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.deleted"; public static final String ROLE_CHANGED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.role_changed"; - public static final String DESIGNATED_PRIMARY_CHANGED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.designated_primary_changed"; + public static final String JOINED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.joined"; public static final String NODE_ROLLEDBACK_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.node_rolledback"; + public static final String DELETED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.deleted"; + public static final String INTRUDER_DETECTED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.intruder_detected"; + public static final String DESIGNATED_PRIMARY_CHANGED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.designated_primary_changed"; + public static final String QUORUM_OVERRIDE_CHANGED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.quorum_override_changed"; + public static final String CREATED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.created"; + public static final String ADDED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.added"; + public static final String QUORUM_LOST_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.quorum_lost"; + public static final String TRANSFER_MASTER_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.transfer_master"; + public static final String REMOVED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.removed"; static { LoggerFactory.getLogger(HIGHAVAILABILITY_LOG_HIERARCHY); - LoggerFactory.getLogger(INTRUDER_DETECTED_LOG_HIERARCHY); - LoggerFactory.getLogger(TRANSFER_MASTER_LOG_HIERARCHY); - LoggerFactory.getLogger(QUORUM_OVERRIDE_CHANGED_LOG_HIERARCHY); - LoggerFactory.getLogger(REMOVED_LOG_HIERARCHY); LoggerFactory.getLogger(LEFT_LOG_HIERARCHY); - LoggerFactory.getLogger(JOINED_LOG_HIERARCHY); - LoggerFactory.getLogger(CREATED_LOG_HIERARCHY); - LoggerFactory.getLogger(QUORUM_LOST_LOG_HIERARCHY); LoggerFactory.getLogger(PRIORITY_CHANGED_LOG_HIERARCHY); - LoggerFactory.getLogger(ADDED_LOG_HIERARCHY); - LoggerFactory.getLogger(DELETED_LOG_HIERARCHY); LoggerFactory.getLogger(ROLE_CHANGED_LOG_HIERARCHY); - LoggerFactory.getLogger(DESIGNATED_PRIMARY_CHANGED_LOG_HIERARCHY); + LoggerFactory.getLogger(JOINED_LOG_HIERARCHY); LoggerFactory.getLogger(NODE_ROLLEDBACK_LOG_HIERARCHY); + LoggerFactory.getLogger(DELETED_LOG_HIERARCHY); + LoggerFactory.getLogger(INTRUDER_DETECTED_LOG_HIERARCHY); + LoggerFactory.getLogger(DESIGNATED_PRIMARY_CHANGED_LOG_HIERARCHY); + LoggerFactory.getLogger(QUORUM_OVERRIDE_CHANGED_LOG_HIERARCHY); + LoggerFactory.getLogger(CREATED_LOG_HIERARCHY); + LoggerFactory.getLogger(ADDED_LOG_HIERARCHY); + LoggerFactory.getLogger(QUORUM_LOST_LOG_HIERARCHY); + LoggerFactory.getLogger(TRANSFER_MASTER_LOG_HIERARCHY); + LoggerFactory.getLogger(REMOVED_LOG_HIERARCHY); _messages = ResourceBundle.getBundle("org.apache.qpid.server.logging.messages.HighAvailability_logmessages", _currentLocale); } /** * Log a HighAvailability message of the Format: - * <pre>HA-1008 : Intruder detected : Node ''{0}'' ({1})</pre> + * <pre>HA-1006 : Left : Node : ''{0}'' ({1})</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage INTRUDER_DETECTED(String param1, String param2) + public static LogMessage LEFT(String param1, String param2) { - String rawMessage = _messages.getString("INTRUDER_DETECTED"); + String rawMessage = _messages.getString("LEFT"); final Object[] messageArguments = {param1, param2}; // Create a new MessageFormat to ensure thread safety. @@ -126,7 +126,7 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return INTRUDER_DETECTED_LOG_HIERARCHY; + return LEFT_LOG_HIERARCHY; } @Override @@ -159,16 +159,16 @@ public class HighAvailabilityMessages /** * Log a HighAvailability message of the Format: - * <pre>HA-1007 : Master transfer requested : to ''{0}'' ({1})</pre> + * <pre>HA-1012 : Priority : {0}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage TRANSFER_MASTER(String param1, String param2) + public static LogMessage PRIORITY_CHANGED(String param1) { - String rawMessage = _messages.getString("TRANSFER_MASTER"); + String rawMessage = _messages.getString("PRIORITY_CHANGED"); - final Object[] messageArguments = {param1, param2}; + final Object[] messageArguments = {param1}; // Create a new MessageFormat to ensure thread safety. // Sharing a MessageFormat and using applyPattern is not thread safe MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); @@ -184,7 +184,7 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return TRANSFER_MASTER_LOG_HIERARCHY; + return PRIORITY_CHANGED_LOG_HIERARCHY; } @Override @@ -217,16 +217,16 @@ public class HighAvailabilityMessages /** * Log a HighAvailability message of the Format: - * <pre>HA-1011 : Minimum group size : {0}</pre> + * <pre>HA-1010 : Role change reported: Node : ''{0}'' ({1}) : from ''{2}'' to ''{3}''</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage QUORUM_OVERRIDE_CHANGED(String param1) + public static LogMessage ROLE_CHANGED(String param1, String param2, String param3, String param4) { - String rawMessage = _messages.getString("QUORUM_OVERRIDE_CHANGED"); + String rawMessage = _messages.getString("ROLE_CHANGED"); - final Object[] messageArguments = {param1}; + final Object[] messageArguments = {param1, param2, param3, param4}; // Create a new MessageFormat to ensure thread safety. // Sharing a MessageFormat and using applyPattern is not thread safe MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); @@ -242,7 +242,7 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return QUORUM_OVERRIDE_CHANGED_LOG_HIERARCHY; + return ROLE_CHANGED_LOG_HIERARCHY; } @Override @@ -275,14 +275,14 @@ public class HighAvailabilityMessages /** * Log a HighAvailability message of the Format: - * <pre>HA-1004 : Removed : Node : ''{0}'' ({1})</pre> + * <pre>HA-1005 : Joined : Node : ''{0}'' ({1})</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage REMOVED(String param1, String param2) + public static LogMessage JOINED(String param1, String param2) { - String rawMessage = _messages.getString("REMOVED"); + String rawMessage = _messages.getString("JOINED"); final Object[] messageArguments = {param1, param2}; // Create a new MessageFormat to ensure thread safety. @@ -300,7 +300,7 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return REMOVED_LOG_HIERARCHY; + return JOINED_LOG_HIERARCHY; } @Override @@ -333,21 +333,16 @@ public class HighAvailabilityMessages /** * Log a HighAvailability message of the Format: - * <pre>HA-1006 : Left : Node : ''{0}'' ({1})</pre> + * <pre>HA-1014 : Diverged transactions discarded</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage LEFT(String param1, String param2) + public static LogMessage NODE_ROLLEDBACK() { - String rawMessage = _messages.getString("LEFT"); - - final Object[] messageArguments = {param1, param2}; - // Create a new MessageFormat to ensure thread safety. - // Sharing a MessageFormat and using applyPattern is not thread safe - MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + String rawMessage = _messages.getString("NODE_ROLLEDBACK"); - final String message = formatter.format(messageArguments); + final String message = rawMessage; return new LogMessage() { @@ -358,7 +353,7 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return LEFT_LOG_HIERARCHY; + return NODE_ROLLEDBACK_LOG_HIERARCHY; } @Override @@ -391,21 +386,16 @@ public class HighAvailabilityMessages /** * Log a HighAvailability message of the Format: - * <pre>HA-1005 : Joined : Node : ''{0}'' ({1})</pre> + * <pre>HA-1002 : Deleted</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage JOINED(String param1, String param2) + public static LogMessage DELETED() { - String rawMessage = _messages.getString("JOINED"); - - final Object[] messageArguments = {param1, param2}; - // Create a new MessageFormat to ensure thread safety. - // Sharing a MessageFormat and using applyPattern is not thread safe - MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + String rawMessage = _messages.getString("DELETED"); - final String message = formatter.format(messageArguments); + final String message = rawMessage; return new LogMessage() { @@ -416,7 +406,7 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return JOINED_LOG_HIERARCHY; + return DELETED_LOG_HIERARCHY; } @Override @@ -449,16 +439,21 @@ public class HighAvailabilityMessages /** * Log a HighAvailability message of the Format: - * <pre>HA-1001 : Created</pre> + * <pre>HA-1008 : Intruder detected : Node ''{0}'' ({1})</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage CREATED() + public static LogMessage INTRUDER_DETECTED(String param1, String param2) { - String rawMessage = _messages.getString("CREATED"); + String rawMessage = _messages.getString("INTRUDER_DETECTED"); - final String message = rawMessage; + final Object[] messageArguments = {param1, param2}; + // Create a new MessageFormat to ensure thread safety. + // Sharing a MessageFormat and using applyPattern is not thread safe + MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + + final String message = formatter.format(messageArguments); return new LogMessage() { @@ -469,7 +464,7 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return CREATED_LOG_HIERARCHY; + return INTRUDER_DETECTED_LOG_HIERARCHY; } @Override @@ -502,16 +497,21 @@ public class HighAvailabilityMessages /** * Log a HighAvailability message of the Format: - * <pre>HA-1009 : Insufficient replicas contactable</pre> + * <pre>HA-1013 : Designated primary : {0}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage QUORUM_LOST() + public static LogMessage DESIGNATED_PRIMARY_CHANGED(String param1) { - String rawMessage = _messages.getString("QUORUM_LOST"); + String rawMessage = _messages.getString("DESIGNATED_PRIMARY_CHANGED"); - final String message = rawMessage; + final Object[] messageArguments = {param1}; + // Create a new MessageFormat to ensure thread safety. + // Sharing a MessageFormat and using applyPattern is not thread safe + MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + + final String message = formatter.format(messageArguments); return new LogMessage() { @@ -522,7 +522,7 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return QUORUM_LOST_LOG_HIERARCHY; + return DESIGNATED_PRIMARY_CHANGED_LOG_HIERARCHY; } @Override @@ -555,14 +555,14 @@ public class HighAvailabilityMessages /** * Log a HighAvailability message of the Format: - * <pre>HA-1012 : Priority : {0}</pre> + * <pre>HA-1011 : Minimum group size : {0}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage PRIORITY_CHANGED(String param1) + public static LogMessage QUORUM_OVERRIDE_CHANGED(String param1) { - String rawMessage = _messages.getString("PRIORITY_CHANGED"); + String rawMessage = _messages.getString("QUORUM_OVERRIDE_CHANGED"); final Object[] messageArguments = {param1}; // Create a new MessageFormat to ensure thread safety. @@ -580,7 +580,7 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return PRIORITY_CHANGED_LOG_HIERARCHY; + return QUORUM_OVERRIDE_CHANGED_LOG_HIERARCHY; } @Override @@ -613,21 +613,16 @@ public class HighAvailabilityMessages /** * Log a HighAvailability message of the Format: - * <pre>HA-1003 : Added : Node : ''{0}'' ({1})</pre> + * <pre>HA-1001 : Created</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage ADDED(String param1, String param2) + public static LogMessage CREATED() { - String rawMessage = _messages.getString("ADDED"); - - final Object[] messageArguments = {param1, param2}; - // Create a new MessageFormat to ensure thread safety. - // Sharing a MessageFormat and using applyPattern is not thread safe - MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + String rawMessage = _messages.getString("CREATED"); - final String message = formatter.format(messageArguments); + final String message = rawMessage; return new LogMessage() { @@ -638,7 +633,7 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return ADDED_LOG_HIERARCHY; + return CREATED_LOG_HIERARCHY; } @Override @@ -671,16 +666,21 @@ public class HighAvailabilityMessages /** * Log a HighAvailability message of the Format: - * <pre>HA-1002 : Deleted</pre> + * <pre>HA-1003 : Added : Node : ''{0}'' ({1})</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage DELETED() + public static LogMessage ADDED(String param1, String param2) { - String rawMessage = _messages.getString("DELETED"); + String rawMessage = _messages.getString("ADDED"); - final String message = rawMessage; + final Object[] messageArguments = {param1, param2}; + // Create a new MessageFormat to ensure thread safety. + // Sharing a MessageFormat and using applyPattern is not thread safe + MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + + final String message = formatter.format(messageArguments); return new LogMessage() { @@ -691,7 +691,7 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return DELETED_LOG_HIERARCHY; + return ADDED_LOG_HIERARCHY; } @Override @@ -724,21 +724,16 @@ public class HighAvailabilityMessages /** * Log a HighAvailability message of the Format: - * <pre>HA-1010 : Role change reported: Node : ''{0}'' ({1}) : from ''{2}'' to ''{3}''</pre> + * <pre>HA-1009 : Insufficient replicas contactable</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage ROLE_CHANGED(String param1, String param2, String param3, String param4) + public static LogMessage QUORUM_LOST() { - String rawMessage = _messages.getString("ROLE_CHANGED"); - - final Object[] messageArguments = {param1, param2, param3, param4}; - // Create a new MessageFormat to ensure thread safety. - // Sharing a MessageFormat and using applyPattern is not thread safe - MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + String rawMessage = _messages.getString("QUORUM_LOST"); - final String message = formatter.format(messageArguments); + final String message = rawMessage; return new LogMessage() { @@ -749,7 +744,7 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return ROLE_CHANGED_LOG_HIERARCHY; + return QUORUM_LOST_LOG_HIERARCHY; } @Override @@ -782,16 +777,16 @@ public class HighAvailabilityMessages /** * Log a HighAvailability message of the Format: - * <pre>HA-1013 : Designated primary : {0}</pre> + * <pre>HA-1007 : Master transfer requested : to ''{0}'' ({1})</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage DESIGNATED_PRIMARY_CHANGED(String param1) + public static LogMessage TRANSFER_MASTER(String param1, String param2) { - String rawMessage = _messages.getString("DESIGNATED_PRIMARY_CHANGED"); + String rawMessage = _messages.getString("TRANSFER_MASTER"); - final Object[] messageArguments = {param1}; + final Object[] messageArguments = {param1, param2}; // Create a new MessageFormat to ensure thread safety. // Sharing a MessageFormat and using applyPattern is not thread safe MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); @@ -807,7 +802,7 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return DESIGNATED_PRIMARY_CHANGED_LOG_HIERARCHY; + return TRANSFER_MASTER_LOG_HIERARCHY; } @Override @@ -840,16 +835,21 @@ public class HighAvailabilityMessages /** * Log a HighAvailability message of the Format: - * <pre>HA-1014 : Diverged transactions discarded</pre> + * <pre>HA-1004 : Removed : Node : ''{0}'' ({1})</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage NODE_ROLLEDBACK() + public static LogMessage REMOVED(String param1, String param2) { - String rawMessage = _messages.getString("NODE_ROLLEDBACK"); + String rawMessage = _messages.getString("REMOVED"); - final String message = rawMessage; + final Object[] messageArguments = {param1, param2}; + // Create a new MessageFormat to ensure thread safety. + // Sharing a MessageFormat and using applyPattern is not thread safe + MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + + final String message = formatter.format(messageArguments); return new LogMessage() { @@ -860,7 +860,7 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return NODE_ROLLEDBACK_LOG_HIERARCHY; + return REMOVED_LOG_HIERARCHY; } @Override Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/KeyStoreMessages.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/KeyStoreMessages.java?rev=1770576&r1=1770575&r2=1770576&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/KeyStoreMessages.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/KeyStoreMessages.java Sun Nov 20 16:42:57 2016 @@ -22,8 +22,8 @@ package org.apache.qpid.server.logging.m import static org.apache.qpid.server.logging.AbstractMessageLogger.DEFAULT_LOG_HIERARCHY_PREFIX; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import org.apache.qpid.server.logging.LogMessage; import java.text.MessageFormat; @@ -63,36 +63,43 @@ public class KeyStoreMessages } public static final String KEYSTORE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "keystore"; - public static final String OPEN_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "keystore.open"; - public static final String EXPIRING_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "keystore.expiring"; - public static final String CREATE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "keystore.create"; public static final String DELETE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "keystore.delete"; + public static final String CREATE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "keystore.create"; + public static final String OPERATION_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "keystore.operation"; + public static final String EXPIRING_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "keystore.expiring"; public static final String CLOSE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "keystore.close"; + public static final String OPEN_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "keystore.open"; static { LoggerFactory.getLogger(KEYSTORE_LOG_HIERARCHY); - LoggerFactory.getLogger(OPEN_LOG_HIERARCHY); - LoggerFactory.getLogger(EXPIRING_LOG_HIERARCHY); - LoggerFactory.getLogger(CREATE_LOG_HIERARCHY); LoggerFactory.getLogger(DELETE_LOG_HIERARCHY); + LoggerFactory.getLogger(CREATE_LOG_HIERARCHY); + LoggerFactory.getLogger(OPERATION_LOG_HIERARCHY); + LoggerFactory.getLogger(EXPIRING_LOG_HIERARCHY); LoggerFactory.getLogger(CLOSE_LOG_HIERARCHY); + LoggerFactory.getLogger(OPEN_LOG_HIERARCHY); _messages = ResourceBundle.getBundle("org.apache.qpid.server.logging.messages.KeyStore_logmessages", _currentLocale); } /** * Log a KeyStore message of the Format: - * <pre>KST-1002 : Open</pre> + * <pre>KST-1004 : Delete "{0}"</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage OPEN() + public static LogMessage DELETE(String param1) { - String rawMessage = _messages.getString("OPEN"); + String rawMessage = _messages.getString("DELETE"); - final String message = rawMessage; + final Object[] messageArguments = {param1}; + // Create a new MessageFormat to ensure thread safety. + // Sharing a MessageFormat and using applyPattern is not thread safe + MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + + final String message = formatter.format(messageArguments); return new LogMessage() { @@ -103,7 +110,7 @@ public class KeyStoreMessages public String getLogHierarchy() { - return OPEN_LOG_HIERARCHY; + return DELETE_LOG_HIERARCHY; } @Override @@ -136,16 +143,16 @@ public class KeyStoreMessages /** * Log a KeyStore message of the Format: - * <pre>KST-1005 : KeyStore {0} Certificate expires in {1} days : {2}</pre> + * <pre>KST-1001 : Create "{0}"</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage EXPIRING(String param1, String param2, String param3) + public static LogMessage CREATE(String param1) { - String rawMessage = _messages.getString("EXPIRING"); + String rawMessage = _messages.getString("CREATE"); - final Object[] messageArguments = {param1, param2, param3}; + final Object[] messageArguments = {param1}; // Create a new MessageFormat to ensure thread safety. // Sharing a MessageFormat and using applyPattern is not thread safe MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); @@ -161,7 +168,7 @@ public class KeyStoreMessages public String getLogHierarchy() { - return EXPIRING_LOG_HIERARCHY; + return CREATE_LOG_HIERARCHY; } @Override @@ -194,14 +201,14 @@ public class KeyStoreMessages /** * Log a KeyStore message of the Format: - * <pre>KST-1001 : Create "{0}"</pre> + * <pre>KST-1006 : Operation : {0}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage CREATE(String param1) + public static LogMessage OPERATION(String param1) { - String rawMessage = _messages.getString("CREATE"); + String rawMessage = _messages.getString("OPERATION"); final Object[] messageArguments = {param1}; // Create a new MessageFormat to ensure thread safety. @@ -219,7 +226,7 @@ public class KeyStoreMessages public String getLogHierarchy() { - return CREATE_LOG_HIERARCHY; + return OPERATION_LOG_HIERARCHY; } @Override @@ -252,16 +259,16 @@ public class KeyStoreMessages /** * Log a KeyStore message of the Format: - * <pre>KST-1004 : Delete "{0}"</pre> + * <pre>KST-1005 : KeyStore {0} Certificate expires in {1} days : {2}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage DELETE(String param1) + public static LogMessage EXPIRING(String param1, String param2, String param3) { - String rawMessage = _messages.getString("DELETE"); + String rawMessage = _messages.getString("EXPIRING"); - final Object[] messageArguments = {param1}; + final Object[] messageArguments = {param1, param2, param3}; // Create a new MessageFormat to ensure thread safety. // Sharing a MessageFormat and using applyPattern is not thread safe MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); @@ -277,7 +284,7 @@ public class KeyStoreMessages public String getLogHierarchy() { - return DELETE_LOG_HIERARCHY; + return EXPIRING_LOG_HIERARCHY; } @Override @@ -334,6 +341,59 @@ public class KeyStoreMessages } @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } + }; + } + + /** + * Log a KeyStore message of the Format: + * <pre>KST-1002 : Open</pre> + * Optional values are contained in [square brackets] and are numbered + * sequentially in the method call. + * + */ + public static LogMessage OPEN() + { + String rawMessage = _messages.getString("OPEN"); + + final String message = rawMessage; + + return new LogMessage() + { + public String toString() + { + return message; + } + + public String getLogHierarchy() + { + return OPEN_LOG_HIERARCHY; + } + + @Override public boolean equals(final Object o) { if (this == o) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
