diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2009-08-06 17:00:43 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2009-08-06 17:00:43 +0000 |
| commit | 6f91ef0947e70bfe266257dfe257617c9417e257 (patch) | |
| tree | a04d50bdfde944aaa5676709209ed4b85ca12d6b | |
| parent | 19df22c7e0600730febfaa1c89cf327dc84e98eb (diff) | |
| download | qpid-python-6f91ef0947e70bfe266257dfe257617c9417e257.tar.gz | |
QPID-2001 : Update to LogMessages.vm to perform the option removal BEFORE replacement is performed. Encountered a problem creating Binding Tests where the brackets '[]' logged by the messsage caused the option removal to fail. Performing the removal before formatting will remove this problem.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@801724 13f79535-47bb-0310-9956-ffa450edef68
| -rw-r--r-- | qpid/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/qpid/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm b/qpid/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm index e2fe7ec3c2..fecc9a787e 100644 --- a/qpid/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm +++ b/qpid/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm @@ -121,27 +121,11 @@ public class ${type.name}Messages public static LogMessage ${message.methodName}(#foreach($parameter in ${message.parameters})${parameter.type} ${parameter.name}#if (${velocityCount} != ${message.parameters.size()} ), #end #end#if(${message.parameters.size()} > 0 && ${message.options.size()} > 0), #end#foreach($option in ${message.options})boolean ${option.name}#if (${velocityCount} != ${message.options.size()} ), #end#end) { -## -## If we don't have any parameters then we don't need the overhead of using the -## message formatter so we can just set our return message to the retreived -## fixed string. -## So we don't need to update the _formatter with the new pattern. -## -## Here we setup rawMessage to be the formatted message ready for direct return -## with the message.name or further processing to remove options. -## -#if(${message.parameters.size()} > 0) - final Object[] messageArguments = {#foreach($parameter in ${message.parameters})${parameter.name}#if (${velocityCount} != ${message.parameters.size()} ), #end#end}; - _formatter.applyPattern(_messages.getString("${message.name}")); - String rawMessage = _formatter.format(messageArguments); -#else - String rawMessage = _messages.getString("${message.name}"); -#end - + String rawMessage = "${message.name} : " + _messages.getString("${message.name}"); ## If we have some options then we need to build the message based ## on those values so only provide that logic if we need it. #if(${message.options.size()} > 0) - StringBuffer msg =new StringBuffer("${message.name} : "); + StringBuffer msg = new StringBuffer(); // Split the formatted message up on the option values so we can // rebuild the message based on the configured options. @@ -167,10 +151,26 @@ public class ${type.name}Messages #end } - final String message = msg.toString(); + rawMessage = msg.toString(); +#end + +## +## If we don't have any parameters then we don't need the overhead of using the +## message formatter so we can just set our return message to the retreived +## fixed string. +## So we don't need to update the _formatter with the new pattern. +## +## Here we setup rawMessage to be the formatted message ready for direct return +## with the message.name or further processing to remove options. +## +#if(${message.parameters.size()} > 0) + final Object[] messageArguments = {#foreach($parameter in ${message.parameters})${parameter.name}#if (${velocityCount} != ${message.parameters.size()} ), #end#end}; + _formatter.applyPattern(rawMessage); + + final String message = _formatter.format(messageArguments); #else -## If we have no options then we can just format and set the log - final String message = "${message.name} : " + rawMessage; +## If we have no parameters then we can skip the formatter and set the log + final String message = rawMessage; #end return new LogMessage() |
