activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject [2/5] https://issues.apache.org/jira/browse/AMQ-4721
Date Fri, 13 Sep 2013 18:53:54 GMT
http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java b/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
index 56da994..6d7b7df 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
@@ -221,9 +221,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
     public void stop() throws Exception {
         if (started.compareAndSet(true, false)) {
             if (disposed.compareAndSet(false, true)) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug(" stopping " + configuration.getBrokerName() + " bridge to " + remoteBrokerName);
-                }
+                LOG.debug(" stopping {} bridge to {}", configuration.getBrokerName(), remoteBrokerName);
 
                 futureRemoteBrokerInfo.cancel(true);
                 futureLocalBrokerInfo.cancel(true);
@@ -235,9 +233,9 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                 try {
                     // local start complete
                     if (startedLatch.getCount() < 2) {
-                        if (LOG.isTraceEnabled()) {
-                            LOG.trace(configuration.getBrokerName() + " unregister bridge (" + this + ") to " + remoteBrokerName);
-                        }
+                        LOG.trace("{} unregister bridge ({}) to {}", new Object[]{
+                                configuration.getBrokerName(), this, remoteBrokerName
+                        });
                         brokerService.getBroker().removeBroker(null, remoteBrokerInfo);
                         brokerService.getBroker().networkBridgeStopped(remoteBrokerInfo);
                     }
@@ -252,16 +250,12 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                                 serialExecutor.shutdown();
                                 if (!serialExecutor.awaitTermination(5, TimeUnit.SECONDS)) {
                                     List<Runnable> pendingTasks = serialExecutor.shutdownNow();
-                                    if (LOG.isInfoEnabled()) {
-                                        LOG.info("pending tasks on stop" + pendingTasks);
-                                    }
+                                        LOG.info("pending tasks on stop {}", pendingTasks);
                                 }
                                 localBroker.oneway(new ShutdownInfo());
                                 remoteBroker.oneway(new ShutdownInfo());
                             } catch (Throwable e) {
-                                if (LOG.isDebugEnabled()) {
-                                    LOG.debug("Caught exception sending shutdown", e);
-                                }
+                                LOG.debug("Caught exception sending shutdown", e);
                             } finally {
                                 sendShutdown.countDown();
                             }
@@ -287,9 +281,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                 }
             }
 
-            if (LOG.isInfoEnabled()) {
-                LOG.info(configuration.getBrokerName() + " bridge to " + remoteBrokerName + " stopped");
-            }
+            LOG.info("{} bridge to {} stopped", configuration.getBrokerName(), remoteBrokerName);
         }
     }
 
@@ -339,11 +331,9 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
             // and if so just stop now before registering anything.
             remoteBrokerId = remoteBrokerInfo.getBrokerId();
             if (localBrokerId.equals(remoteBrokerId)) {
-                 if (LOG.isTraceEnabled()) {
-                     LOG.trace(configuration.getBrokerName() +
-                         " disconnecting remote loop back connection for: " +
-                         remoteBrokerName + ", with id:" + remoteBrokerId);
-                 }
+                LOG.trace("{} disconnecting remote loop back connector for: {}, with id: {}", new Object[]{
+                        configuration.getBrokerName(), remoteBrokerName, remoteBrokerId
+                });
                  ServiceSupport.dispose(localBroker);
                  ServiceSupport.dispose(remoteBroker);
                  // the bridge is left in a bit of limbo, but it won't get retried
@@ -389,7 +379,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                             new ActiveMQDestination[configuration.getDynamicallyIncludedDestinations().size()]);
                 }
             } catch (Throwable t) {
-                LOG.error("Error mapping remote configuration: " + props, t);
+                LOG.error("Error mapping remote configuration: {}", props, t);
             }
         }
 
@@ -410,9 +400,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
     private void startLocalBridge() throws Throwable {
         if (localBridgeStarted.compareAndSet(false, true)) {
             synchronized (this) {
-                if (LOG.isTraceEnabled()) {
-                    LOG.trace(configuration.getBrokerName() + " starting local Bridge, localBroker=" + localBroker);
-                }
+                LOG.trace("{} starting local Bridge, localBroker={}", configuration.getBrokerName(), localBroker);
                 if (!disposed.get()) {
                     localConnectionInfo = new ConnectionInfo();
                     localConnectionInfo.setConnectionId(new ConnectionId(idGenerator.generateId()));
@@ -471,12 +459,12 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                     // new peer broker (a consumer can work with remote broker also)
                     brokerService.getBroker().addBroker(null, remoteBrokerInfo);
 
-                    if (LOG.isInfoEnabled()) {
-                        LOG.info("Network connection between " + localBroker + " and " + remoteBroker + "(" + remoteBrokerName + ") has been established.");
-                        if (LOG.isTraceEnabled()) {
-                            LOG.trace(configuration.getBrokerName() + " register bridge (" + this + ") to " + remoteBrokerName);
-                        }
-                    }
+                    LOG.info("Network connection between {} and {} ({}) has been established.", new Object[]{
+                            localBroker, remoteBroker, remoteBrokerName
+                    });
+                    LOG.trace("{} register bridge ({}) to {}", new Object[]{
+                            configuration.getBrokerName(), this, remoteBrokerName
+                    });
                 } else {
                     LOG.warn("Bridge was disposed before the startLocalBridge() method was fully executed.");
                 }
@@ -487,17 +475,16 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
             if (!disposed.get()) {
                 setupStaticDestinations();
             } else {
-                LOG.warn("Network connection between " + localBroker + " and " + remoteBroker + "(" + remoteBrokerName
-                    + ") was interrupted during establishment.");
+                LOG.warn("Network connection between {} and {} ({}) was interrupted during establishment.", new Object[]{
+                        localBroker, remoteBroker, remoteBrokerName
+                });
             }
         }
     }
 
     protected void startRemoteBridge() throws Exception {
         if (remoteBridgeStarted.compareAndSet(false, true)) {
-            if (LOG.isTraceEnabled()) {
-                LOG.trace(configuration.getBrokerName() + " starting remote Bridge, remoteBroker=" + remoteBroker);
-            }
+            LOG.trace("{} starting remote Bridge, remoteBroker={}", configuration.getBrokerName(), remoteBroker);
             synchronized (this) {
                 if (!isCreatedByDuplex()) {
                     BrokerInfo brokerInfo = new BrokerInfo();
@@ -552,11 +539,15 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
     public void serviceRemoteException(Throwable error) {
         if (!disposed.get()) {
             if (error instanceof SecurityException || error instanceof GeneralSecurityException) {
-                LOG.error("Network connection between " + localBroker + " and " + remoteBroker + " shutdown due to a remote error: " + error);
+                LOG.error("Network connection between {} and {} shutdown due to a remote error: {}", new Object[]{
+                        localBroker, remoteBroker, error
+                });
             } else {
-                LOG.warn("Network connection between " + localBroker + " and " + remoteBroker + " shutdown due to a remote error: " + error);
+                LOG.warn("Network connection between {} and {} shutdown due to a remote error: {}", new Object[]{
+                        localBroker, remoteBroker, error
+                });
             }
-            LOG.debug("The remote Exception was: " + error, error);
+            LOG.debug("The remote Exception was: {}", error, error);
             brokerService.getTaskRunnerFactory().execute(new Runnable() {
                 @Override
                 public void run() {
@@ -582,9 +573,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                     serviceRemoteException(ce.getException());
                 } else {
                     if (isDuplex()) {
-                        if (LOG.isTraceEnabled()) {
-                            LOG.trace(configuration.getBrokerName() + " duplex command type: " + command.getDataStructureType());
-                        }
+                        LOG.trace("{} duplex command type: {}", configuration.getBrokerName(), command.getDataStructureType());
                         if (command.isMessage()) {
                             final ActiveMQMessage message = (ActiveMQMessage) command;
                             if (AdvisorySupport.isConsumerAdvisoryTopic(message.getDestination())
@@ -609,7 +598,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                                                 reply.setCorrelationId(correlationId);
                                                 remoteBroker.oneway(reply);
                                             } catch (IOException error) {
-                                                LOG.error("Exception: " + error + " on duplex forward of: " + message);
+                                                LOG.error("Exception: {} on duplex forward of: {}", error, message);
                                                 serviceRemoteException(error);
                                             }
                                         }
@@ -634,7 +623,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                                         ack.setConsumerId(localSub.getLocalInfo().getConsumerId());
                                         localBroker.oneway(ack);
                                     } else {
-                                        LOG.warn("Matching local subscription not found for ack: " + ack);
+                                        LOG.warn("Matching local subscription not found for ack: {}", ack);
                                     }
                                     break;
                                 case ConsumerInfo.DATA_STRUCTURE_TYPE:
@@ -643,7 +632,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                                         addConsumerInfo((ConsumerInfo) command);
                                     } else {
                                         // received a subscription whilst stopping
-                                        LOG.warn("Stopping - ignoring ConsumerInfo: " + command);
+                                        LOG.warn("Stopping - ignoring ConsumerInfo: {}", command);
                                     }
                                     break;
                                 case ShutdownInfo.DATA_STRUCTURE_TYPE:
@@ -653,9 +642,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                                     serviceRemoteException(new IOException(command.toString()));
                                     break;
                                 default:
-                                    if (LOG.isDebugEnabled()) {
-                                        LOG.debug("Ignoring remote command: " + command);
-                                    }
+                                    LOG.debug("Ignoring remote command: {}", command);
                             }
                         }
                     } else {
@@ -665,14 +652,12 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                             case ShutdownInfo.DATA_STRUCTURE_TYPE:
                                 break;
                             default:
-                                LOG.warn("Unexpected remote command: " + command);
+                                LOG.warn("Unexpected remote command: {}", command);
                         }
                     }
                 }
             } catch (Throwable e) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Exception processing remote command: " + command, e);
-                }
+                LOG.debug("Exception processing remote command: {}", command, e);
                 serviceRemoteException(e);
             }
         }
@@ -696,34 +681,30 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
             BrokerId[] path = info.getBrokerPath();
 
             if (info.isBrowser()) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.info(configuration.getBrokerName() + " Ignoring sub from " + remoteBrokerName + ", browsers explicitly suppressed");
-                }
+                LOG.info("{} Ignoring sub from {}, browsers explicitly suppressed", configuration.getBrokerName(), remoteBrokerName);
                 return;
             }
 
             if (path != null && networkTTL > -1 && path.length >= networkTTL) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug(configuration.getBrokerName() + " Ignoring sub from " + remoteBrokerName + ", restricted to " + networkTTL
-                        + " network hops only : " + info);
-                }
+                LOG.debug("{} Ignoring sub from {}, restricted to {} network hops only: {}", new Object[]{
+                        configuration.getBrokerName(), remoteBrokerName, networkTTL, info
+                });
                 return;
             }
 
             if (contains(path, localBrokerPath[0])) {
                 // Ignore this consumer as it's a consumer we locally sent to the broker.
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug(configuration.getBrokerName() + " Ignoring sub from " + remoteBrokerName + ", already routed through this broker once : " + info);
-                }
+                LOG.debug("{} Ignoring sub from {}, already routed through this broker once: {}", new Object[]{
+                        configuration.getBrokerName(), remoteBrokerName, info
+                });
                 return;
             }
 
             if (!isPermissableDestination(info.getDestination())) {
                 // ignore if not in the permitted or in the excluded list
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug(configuration.getBrokerName() + " Ignoring sub from " + remoteBrokerName + ", destination " + info.getDestination()
-                        + " is not permiited :" + info);
-                }
+                LOG.debug("{} Ignoring sub from {}, destination {} is not permitted: {}", new Object[]{
+                        configuration.getBrokerName(), remoteBrokerName, info.getDestination(), info
+                });
                 return;
             }
 
@@ -737,15 +718,13 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
             final DestinationInfo destInfo = (DestinationInfo) data;
             BrokerId[] path = destInfo.getBrokerPath();
             if (path != null && networkTTL > -1 && path.length >= networkTTL) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug(configuration.getBrokerName() + " Ignoring destination " + destInfo + " restricted to " + networkTTL + " network hops only");
-                }
+                LOG.debug("{} Ignoring destination {} restricted to {} network hops only", new Object[]{
+                        configuration.getBrokerName(), destInfo, networkTTL
+                });
                 return;
             }
             if (contains(destInfo.getBrokerPath(), localBrokerPath[0])) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug(configuration.getBrokerName() + " Ignoring destination " + destInfo + " already routed through this broker once");
-                }
+                LOG.debug("{} Ignoring destination {} already routed through this broker once", configuration.getBrokerName(), destInfo);
                 return;
             }
             destInfo.setConnectionId(localConnectionInfo.getConnectionId());
@@ -755,10 +734,9 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                 tempDest.setConnectionId(localSessionInfo.getSessionId().getConnectionId());
             }
             destInfo.setBrokerPath(appendToBrokerPath(destInfo.getBrokerPath(), getRemoteBrokerPath()));
-            if (LOG.isTraceEnabled()) {
-                LOG.trace(configuration.getBrokerName() + " bridging " + (destInfo.isAddOperation() ? "add" : "remove") + " destination on " + localBroker
-                    + " from " + remoteBrokerName + ", destination: " + destInfo);
-            }
+            LOG.trace("{} bridging {} destination on {} from {}, destination: {}", new Object[]{
+                    configuration.getBrokerName(), (destInfo.isAddOperation() ? "add" : "remove"), localBroker, remoteBrokerName, destInfo
+            });
             if (destInfo.isRemoveOperation()) {
                 // Serialize with removeSub operations such that all removeSub advisories
                 // are generated
@@ -768,7 +746,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                         try {
                             localBroker.oneway(destInfo);
                         } catch (IOException e) {
-                            LOG.warn("failed to deliver remove command for destination:" + destInfo.getDestination(), e);
+                            LOG.warn("failed to deliver remove command for destination: {}", destInfo.getDestination(), e);
                         }
                     }
                 });
@@ -815,27 +793,23 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                 // not a reason to terminate the bridge - temps can disappear with
                 // pending sends as the demand sub may outlive the remote dest
                 if (messageDispatch != null) {
-                    LOG.warn("PoisonAck of " + messageDispatch.getMessage().getMessageId() + " on forwarding error: " + error);
+                    LOG.warn("PoisonAck of {} on forwarding error: {}", messageDispatch.getMessage().getMessageId(), error);
                     try {
                         MessageAck poisonAck = new MessageAck(messageDispatch, MessageAck.POSION_ACK_TYPE, 1);
                         poisonAck.setPoisonCause(error);
                         localBroker.oneway(poisonAck);
                     } catch (IOException ioe) {
-                        LOG.error("Failed to posion ack message following forward failure: " + ioe, ioe);
+                        LOG.error("Failed to posion ack message following forward failure: ", ioe);
                     }
                     fireFailedForwardAdvisory(messageDispatch, error);
                 } else {
-                    LOG.warn("Ignoring exception on forwarding to non existent temp dest: " + error, error);
+                    LOG.warn("Ignoring exception on forwarding to non existent temp dest: ", error);
                 }
                 return;
             }
 
-            if (LOG.isInfoEnabled()) {
-                LOG.info("Network connection between " + localBroker + " and " + remoteBroker + " shutdown due to a local error: " + error);
-            }
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("The local Exception was:" + error, error);
-            }
+            LOG.info("Network connection between {} and {} shutdown due to a local error: {}", new Object[]{ localBroker, remoteBroker, error });
+            LOG.debug("The local Exception was: {}", error, error);
 
             brokerService.getTaskRunnerFactory().execute(new Runnable() {
                 @Override
@@ -865,10 +839,8 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
 
                 }
             } catch (Exception e) {
-                LOG.warn("failed to fire forward failure advisory, cause: " + e);
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("detail", e);
-                }
+                LOG.warn("failed to fire forward failure advisory, cause: {}", e);
+                LOG.debug("detail", e);
             }
         }
     }
@@ -890,10 +862,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
 
     protected void removeSubscription(final DemandSubscription sub) throws IOException {
         if (sub != null) {
-            if (LOG.isTraceEnabled()) {
-                LOG.trace(configuration.getBrokerName() + " remove local subscription:" + sub.getLocalInfo().getConsumerId() + " for remote "
-                    + sub.getRemoteInfo().getConsumerId());
-            }
+            LOG.trace("{} remove local subscription: {} for remote {}", new Object[]{ configuration.getBrokerName(), sub.getLocalInfo().getConsumerId(), sub.getRemoteInfo().getConsumerId() });
 
             // ensure not available for conduit subs pending removal
             subscriptionMapByLocalId.remove(sub.getLocalInfo().getConsumerId());
@@ -909,7 +878,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                     try {
                         localBroker.oneway(sub.getLocalInfo().createRemoveCommand());
                     } catch (IOException e) {
-                        LOG.warn("failed to deliver remove command for local subscription, for remote " + sub.getRemoteInfo().getConsumerId(), e);
+                        LOG.warn("failed to deliver remove command for local subscription, for remote {}", sub.getRemoteInfo().getConsumerId(), e);
                     }
                 }
             });
@@ -944,11 +913,9 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                     if (sub != null && md.getMessage() != null && sub.incrementOutstandingResponses()) {
 
                         if (suppressMessageDispatch(md, sub)) {
-                            if (LOG.isDebugEnabled()) {
-                                LOG.debug(configuration.getBrokerName() + " message not forwarded to " + remoteBrokerName
-                                    + " because message came from there or fails TTL, brokerPath: " + Arrays.toString(md.getMessage().getBrokerPath())
-                                    + ", message: " + md.getMessage());
-                            }
+                            LOG.debug("{} message not forwarded to {} because message came from there or fails TTL, brokerPath: {}, message: {}", new Object[]{
+                                    configuration.getBrokerName(), remoteBrokerName, Arrays.toString(md.getMessage().getBrokerPath()), md.getMessage()
+                            });
                             // still ack as it may be durable
                             try {
                                 localBroker.oneway(new MessageAck(md, MessageAck.INDIVIDUAL_ACK_TYPE, 1));
@@ -959,11 +926,9 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                         }
 
                         Message message = configureMessage(md);
-                        if (LOG.isDebugEnabled()) {
-                            LOG.debug("bridging (" + configuration.getBrokerName() + " -> " + remoteBrokerName + ") "
-                                + (LOG.isTraceEnabled() ? message : message.getMessageId()) + ", consumer: " + md.getConsumerId() + ", destination "
-                                + message.getDestination() + ", brokerPath: " + Arrays.toString(message.getBrokerPath()) + ", message: " + message);
-                        }
+                        LOG.debug("bridging ({} -> {}), consumer: {}, destinaition: {}, brokerPath: {}, message: {}", new Object[]{
+                                configuration.getBrokerName(), remoteBrokerName, (LOG.isTraceEnabled() ? message : message.getMessageId()), md.getConsumerId(), message.getDestination(), Arrays.toString(message.getBrokerPath()), message
+                        });
 
                         if (isDuplex() && AdvisorySupport.ADIVSORY_MESSAGE_TYPE.equals(message.getType())) {
                             try {
@@ -1013,15 +978,12 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                             }
                         }
                     } else {
-                        if (LOG.isDebugEnabled()) {
-                            LOG.debug("No subscription registered with this network bridge for consumerId " + md.getConsumerId() + " for message: "
-                                + md.getMessage());
-                        }
+                        LOG.debug("No subscription registered with this network bridge for consumerId: {} for message: {}", md.getConsumerId(), md.getMessage());
                     }
                 } else if (command.isBrokerInfo()) {
                     futureLocalBrokerInfo.set((BrokerInfo) command);
                 } else if (command.isShutdownInfo()) {
-                    LOG.info(configuration.getBrokerName() + " Shutting down");
+                    LOG.info("{} Shutting down", configuration.getBrokerName());
                     stop();
                 } else if (command.getClass() == ConnectionError.class) {
                     ConnectionError ce = (ConnectionError) command;
@@ -1031,7 +993,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                         case WireFormatInfo.DATA_STRUCTURE_TYPE:
                             break;
                         default:
-                            LOG.warn("Unexpected local command: " + command);
+                            LOG.warn("Unexpected local command: {}", command);
                     }
                 }
             } catch (Throwable e) {
@@ -1144,11 +1106,9 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                 try {
                     addSubscription(sub);
                 } catch (IOException e) {
-                    LOG.error("Failed to add static destination " + dest, e);
-                }
-                if (LOG.isTraceEnabled()) {
-                    LOG.trace(configuration.getBrokerName() + ", bridging messages for static destination: " + dest);
+                    LOG.error("Failed to add static destination {}", dest, e);
                 }
+                LOG.trace("{}, bridging messages for static destination: {}", configuration.getBrokerName(), dest);
             }
         }
     }
@@ -1165,7 +1125,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                     sub.getDurableRemoteSubs().add(new SubscriptionInfo(sub.getRemoteInfo().getClientId(), consumerInfo.getSubscriptionName()));
                 }
                 addSubscription(sub);
-                LOG.debug(configuration.getBrokerName() + " new demand subscription: " + sub);
+                LOG.debug("{} new demand subscription: {}", configuration.getBrokerName(), sub);
             }
         }
     }
@@ -1215,24 +1175,20 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
         boolean suppress = false;
 
         if (existingSub.getConsumerInfo().getPriority() >= candidateInfo.getPriority()) {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug(configuration.getBrokerName() + " Ignoring duplicate subscription from " + remoteBrokerName + ", sub: " + candidateInfo
-                    + " is duplicated by network subscription with equal or higher network priority: " + existingSub + ", networkConsumerIds: "
-                    + existingSub.getConsumerInfo().getNetworkConsumerIds());
-            }
+            LOG.debug("{} Ignoring duplicate subscription from {}, sub: {} is duplicate by network subscription with equal or higher network priority: {}, networkConsumerIds: {}", new Object[]{
+                    configuration.getBrokerName(), remoteBrokerName, candidateInfo, existingSub, existingSub.getConsumerInfo().getNetworkConsumerIds()
+            });
             suppress = true;
         } else {
             // remove the existing lower priority duplicate and allow this candidate
             try {
                 removeDuplicateSubscription(existingSub);
 
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug(configuration.getBrokerName() + " Replacing duplicate subscription " + existingSub.getConsumerInfo() + " with sub from "
-                        + remoteBrokerName + ", which has a higher priority, new sub: " + candidateInfo + ", networkComsumerIds: "
-                        + candidateInfo.getNetworkConsumerIds());
-                }
+                LOG.debug("{} Replacing duplicate subscription {} with sub from {}, which has a higher priority, new sub: {}, networkConsumerIds: {}", new Object[]{
+                        configuration.getBrokerName(), existingSub.getConsumerInfo(), remoteBrokerName, candidateInfo, candidateInfo.getNetworkConsumerIds()
+                });
             } catch (IOException e) {
-                LOG.error("Failed to remove duplicated sub as a result of sub with higher priority, sub: " + existingSub, e);
+                LOG.error("Failed to remove duplicated sub as a result of sub with higher priority, sub: {}", existingSub, e);
             }
         }
         return suppress;
@@ -1309,9 +1265,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                 priority -= info.getBrokerPath().length + 1;
             }
             result.getLocalInfo().setPriority(priority);
-            if (LOG.isDebugEnabled()) {
-                LOG.debug(configuration.getBrokerName() + " using priority :" + priority + " for subscription: " + info);
-            }
+            LOG.debug("{} using priority: {} for subscription: {}", new Object[]{ configuration.getBrokerName(), priority, info });
         }
         configureDemandSubscription(info, result);
         return result;
@@ -1359,15 +1313,14 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
 
     protected void removeDemandSubscription(ConsumerId id) throws IOException {
         DemandSubscription sub = subscriptionMapByRemoteId.remove(id);
-        if (LOG.isDebugEnabled()) {
-            LOG.debug(configuration.getBrokerName() + " remove request on " + localBroker + " from " + remoteBrokerName + " , consumer id: " + id
-                + ", matching sub: " + sub);
-        }
+        LOG.debug("{} remove request on {} from {}, consumer id: {}, matching sub: {}", new Object[]{
+                configuration.getBrokerName(), localBroker, remoteBrokerName, id, sub
+        });
         if (sub != null) {
             removeSubscription(sub);
-            if (LOG.isDebugEnabled()) {
-                LOG.debug(configuration.getBrokerName() + " removed sub on " + localBroker + " from " + remoteBrokerName + " :  " + sub.getRemoteInfo());
-            }
+            LOG.debug("{} removed sub on {} from {}: {}", new Object[]{
+                    configuration.getBrokerName(), localBroker, remoteBrokerName, sub.getRemoteInfo()
+            });
         }
     }
 
@@ -1379,7 +1332,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                 removeDemandSubscription(sub.getRemoteInfo().getConsumerId());
                 removeDone = true;
             } catch (IOException e) {
-                LOG.debug("removeDemandSubscriptionByLocalId failed for localId: " + consumerId, e);
+                LOG.debug("removeDemandSubscriptionByLocalId failed for localId: {}", consumerId, e);
             }
         }
         return removeDone;
@@ -1618,9 +1571,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                 return info;
             } catch (InterruptedException e) {
                 Thread.currentThread().interrupt();
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Operation interupted: " + e, e);
-                }
+                LOG.debug("Operation interrupted: {}", e, e);
                 throw new InterruptedException("Interrupted.");
             }
         }

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/network/DemandSubscription.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/DemandSubscription.java b/activemq-broker/src/main/java/org/apache/activemq/network/DemandSubscription.java
index 12cfe14..e67565b 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/network/DemandSubscription.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/network/DemandSubscription.java
@@ -107,9 +107,7 @@ public class DemandSubscription {
 
     public void waitForCompletion() {
         if (dispatched.get() > 0) {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Waiting for completion for sub: " + localInfo.getConsumerId() + ", dispatched: " + this.dispatched.get());
-            }
+            LOG.debug("Waiting for completion for sub: {}, dispatched: {}", localInfo.getConsumerId(), this.dispatched.get());
             activeWaiter.set(true);
             if (dispatched.get() > 0) {
                 synchronized (activeWaiter) {
@@ -119,8 +117,7 @@ public class DemandSubscription {
                     }
                 }
                 if (this.dispatched.get() > 0) {
-                    LOG.warn("demand sub interrupted or timedout while waiting for outstanding responses, " +
-                             "expect potentially " + this.dispatched.get() + " duplicate forwards");
+                    LOG.warn("demand sub interrupted or timedout while waiting for outstanding responses, expect potentially {} duplicate forwards", this.dispatched.get());
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/network/DiscoveryNetworkConnector.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/DiscoveryNetworkConnector.java b/activemq-broker/src/main/java/org/apache/activemq/network/DiscoveryNetworkConnector.java
index 3fd2bd7..ed71b7b 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/network/DiscoveryNetworkConnector.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/network/DiscoveryNetworkConnector.java
@@ -70,7 +70,7 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco
             // allow discovery agent to grab it's parameters
             IntrospectionSupport.setProperties(getDiscoveryAgent(), parameters);
         } catch (URISyntaxException e) {
-            LOG.warn("failed to parse query parameters from discoveryURI: " + discoveryURI, e);
+            LOG.warn("failed to parse query parameters from discoveryURI: {}", discoveryURI, e);
         }
     }
 
@@ -90,29 +90,23 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco
             try {
                 uri = new URI(url);
             } catch (URISyntaxException e) {
-                LOG.warn("Could not connect to remote URI: " + url + " due to bad URI syntax: " + e, e);
+                LOG.warn("Could not connect to remote URI: {} due to bad URI syntax: ", url, e);
                 return;
             }
 
             if (localURI.equals(uri)) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("not connecting loopback: " + uri);
-                }
+                LOG.debug("not connecting loopback: {}", uri);
                 return;
             }
 
             if (connectionFilter != null && !connectionFilter.connectTo(uri)) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("connectionFilter disallows connection to: " + uri);
-                }
+                LOG.debug("connectionFilter disallows connection to: {}", uri);
                 return;
             }
 
             // Should we try to connect to that URI?
             if (activeEvents.putIfAbsent(uri, event) != null) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Discovery agent generated a duplicate onServiceAdd event for: " + uri);
-                }
+                LOG.debug("Discovery agent generated a duplicate onServiceAdd event for: {}", uri);
                 return;
             }
 
@@ -120,12 +114,10 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco
             try {
                 connectUri = URISupport.applyParameters(connectUri, parameters, DISCOVERED_OPTION_PREFIX);
             } catch (URISyntaxException e) {
-                LOG.warn("could not apply query parameters: " + parameters + " to: " + connectUri, e);
+                LOG.warn("could not apply query parameters: {} to: {}", new Object[]{ parameters, connectUri }, e);
             }
 
-            if (LOG.isInfoEnabled()) {
-                LOG.info("Establishing network connection from " + localURI + " to " + connectUri);
-            }
+            LOG.info("Establishing network connection from {} to {}", localURI, connectUri);
 
             Transport remoteTransport;
             Transport localTransport;
@@ -135,10 +127,8 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco
                 try {
                     remoteTransport = TransportFactory.connect(connectUri);
                 } catch (Exception e) {
-                    LOG.warn("Could not connect to remote URI: " + connectUri + ": " + e.getMessage());
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("Connection failure exception: " + e, e);
-                    }
+                    LOG.warn("Could not connect to remote URI: {}: {}", connectUri, e.getMessage());
+                    LOG.debug("Connection failure exception: ", e);
                     activeEvents.remove(uri);
                     return;
                 }
@@ -146,10 +136,8 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco
                     localTransport = createLocalTransport();
                 } catch (Exception e) {
                     ServiceSupport.dispose(remoteTransport);
-                    LOG.warn("Could not connect to local URI: " + localURI + ": " + e.getMessage());
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("Connection failure exception: " + e, e);
-                    }
+                    LOG.warn("Could not connect to local URI: {}: {}", localURI, e.getMessage());
+                    LOG.debug("Connection failure exception: ", e);
                     activeEvents.remove(uri);
                     return;
                 }
@@ -165,17 +153,13 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco
             } catch (Exception e) {
                 ServiceSupport.dispose(localTransport);
                 ServiceSupport.dispose(remoteTransport);
-                LOG.warn("Could not start network bridge between: " + localURI + " and: " + uri + " due to: " + e);
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Start failure exception: " + e, e);
-                }
+                LOG.warn("Could not start network bridge between: {} and: {} due to: {}", new Object[]{ localURI, uri, e });
+                LOG.debug("Start failure exception: ", e);
                 try {
                     // Will remove bridge and active event.
                     discoveryAgent.serviceFailed(event);
                 } catch (IOException e1) {
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("Discovery agent failure while handling failure event: " + e1.getMessage(), e1);
-                    }
+                    LOG.debug("Discovery agent failure while handling failure event: {}", e1.getMessage(), e1);
                 }
             }
         }
@@ -189,7 +173,7 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco
             try {
                 uri = new URI(url);
             } catch (URISyntaxException e) {
-                LOG.warn("Could not connect to remote URI: " + url + " due to bad URI syntax: " + e, e);
+                LOG.warn("Could not connect to remote URI: {} due to bad URI syntax: ", url, e);
                 return;
             }
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/network/DurableConduitBridge.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/DurableConduitBridge.java b/activemq-broker/src/main/java/org/apache/activemq/network/DurableConduitBridge.java
index 7001a8d..d2d9a79 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/network/DurableConduitBridge.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/network/DurableConduitBridge.java
@@ -65,11 +65,9 @@ public class DurableConduitBridge extends ConduitBridge {
                     try {
                         addSubscription(sub);
                     } catch (IOException e) {
-                        LOG.error("Failed to add static destination " + dest, e);
-                    }
-                    if (LOG.isTraceEnabled()) {
-                        LOG.trace("Forwarding messages for durable destination: " + dest);
+                        LOG.error("Failed to add static destination {}", dest, e);
                     }
+                    LOG.trace("Forwarding messages for durable destination: {}", dest);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/network/ForwardingBridge.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/ForwardingBridge.java b/activemq-broker/src/main/java/org/apache/activemq/network/ForwardingBridge.java
index 5f90e66..c8211c1 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/network/ForwardingBridge.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/network/ForwardingBridge.java
@@ -84,8 +84,7 @@ public class ForwardingBridge implements Service {
     }
 
     public void start() throws Exception {
-        LOG.info("Starting a network connection between " + localBroker + " and " + remoteBroker
-                 + " has been established.");
+        LOG.info("Starting a network connection between {} and {} has been established.", localBroker, remoteBroker);
 
         localBroker.setTransportListener(new DefaultTransportListener() {
             public void onCommand(Object o) {
@@ -119,7 +118,7 @@ public class ForwardingBridge implements Service {
                 try {
                     startBridge();
                 } catch (IOException e) {
-                    LOG.error("Failed to start network bridge: " + e, e);
+                    LOG.error("Failed to start network bridge: ", e);
                 }
             }
         };
@@ -162,10 +161,7 @@ public class ForwardingBridge implements Service {
             localBroker.oneway(topicConsumerInfo);
         }
 
-        if (LOG.isInfoEnabled()) {
-            LOG.info("Network connection between " + localBroker + " and " + remoteBroker
-                     + " has been established.");
-        }
+        LOG.info("Network connection between {} and {} has been established.", localBroker, remoteBroker);
     }
 
     public void stop() throws Exception {
@@ -187,10 +183,8 @@ public class ForwardingBridge implements Service {
     }
 
     public void serviceRemoteException(Throwable error) {
-        LOG.info("Unexpected remote exception: " + error);
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Exception trace: ", error);
-        }
+        LOG.info("Unexpected remote exception: {}", error.getMessage());
+        LOG.debug("Exception trace: ", error);
     }
 
     protected void serviceRemoteCommand(Command command) {
@@ -209,7 +203,7 @@ public class ForwardingBridge implements Service {
                     }
                 }
             } else {
-                LOG.warn("Unexpected remote command: " + command);
+                LOG.warn("Unexpected remote command: {}", command);
             }
         } catch (IOException e) {
             serviceLocalException(e);
@@ -217,7 +211,7 @@ public class ForwardingBridge implements Service {
     }
 
     public void serviceLocalException(Throwable error) {
-        LOG.info("Unexpected local exception: " + error);
+        LOG.info("Unexpected local exception: {}", error.getMessage());
         LOG.debug("Exception trace: ", error);
         fireBridgeFailed();
     }
@@ -315,7 +309,7 @@ public class ForwardingBridge implements Service {
                     }
                 }
             } else {
-                LOG.debug("Unexpected local command: " + command);
+                LOG.debug("Unexpected local command: {}", command);
             }
         } catch (IOException e) {
             serviceLocalException(e);

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/network/LdapNetworkConnector.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/LdapNetworkConnector.java b/activemq-broker/src/main/java/org/apache/activemq/network/LdapNetworkConnector.java
index 41c545f..3445b5a 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/network/LdapNetworkConnector.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/network/LdapNetworkConnector.java
@@ -203,13 +203,13 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
         Hashtable<String, String> env = new Hashtable<String, String>();
         env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
         this.ldapURI = getUri();
-        LOG.debug("    URI [" + this.ldapURI + "]");
+        LOG.debug("    URI [{}]", this.ldapURI);
         env.put(Context.PROVIDER_URL, this.ldapURI.toString());
         if (anonymousAuthentication) {
             LOG.debug("    login credentials [anonymous]");
             env.put(Context.SECURITY_AUTHENTICATION, "none");
         } else {
-            LOG.debug("    login credentials [" + user + ":******]");
+            LOG.debug("    login credentials [{}:******]", user);
             env.put(Context.SECURITY_PRINCIPAL, user);
             env.put(Context.SECURITY_CREDENTIALS, password);
         }
@@ -221,7 +221,7 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
             } catch (CommunicationException err) {
                 if (failover) {
                     this.ldapURI = getUri();
-                    LOG.error("connection error [" + env.get(Context.PROVIDER_URL) + "], failover connection to [" + this.ldapURI.toString() + "]");
+                    LOG.error("connection error [{}], failover connection to [{}]", env.get(Context.PROVIDER_URL), this.ldapURI.toString());
                     env.put(Context.PROVIDER_URL, this.ldapURI.toString());
                     Thread.sleep(curReconnectDelay);
                     curReconnectDelay = Math.min(curReconnectDelay * 2, maxReconnectDelay);
@@ -233,9 +233,9 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
 
         // add connectors from search results
         LOG.info("searching for network connectors...");
-        LOG.debug("    base   [" + base + "]");
-        LOG.debug("    filter [" + searchFilter + "]");
-        LOG.debug("    scope  [" + searchControls.getSearchScope() + "]");
+        LOG.debug("    base   [{}]", base);
+        LOG.debug("    filter [{}]", searchFilter);
+        LOG.debug("    scope  [{}]", searchControls.getSearchScope());
         NamingEnumeration<SearchResult> results = context.search(base, searchFilter, searchControls);
         while (results.hasMore()) {
             addConnector(results.next());
@@ -278,14 +278,14 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
     protected synchronized void addConnector(SearchResult result) throws Exception {
         String uuid = toUUID(result);
         if (uuidMap.containsKey(uuid)) {
-            LOG.warn("connector already regsitered for UUID [" + uuid + "]");
+            LOG.warn("connector already regsitered for UUID [{}]", uuid);
             return;
         }
 
         URI connectorURI = toURI(result);
         if (connectorMap.containsKey(connectorURI)) {
             int referenceCount = referenceMap.get(connectorURI) + 1;
-            LOG.warn("connector reference added for URI [" + connectorURI + "], UUID [" + uuid + "], total reference(s) [" + referenceCount + "]");
+            LOG.warn("connector reference added for URI [{}], UUID [{}], total reference(s) [{}]", new Object[]{ connectorURI, uuid, referenceCount });
             referenceMap.put(connectorURI, referenceCount);
             uuidMap.put(uuid, connectorURI);
             return;
@@ -320,7 +320,7 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
         referenceMap.put(connectorURI, 1);
         uuidMap.put(uuid, connectorURI);
         connector.start();
-        LOG.info("connector added with URI [" + connectorURI + "]");
+        LOG.info("connector added with URI [{}]", connectorURI);
     }
 
     /**
@@ -332,20 +332,20 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
     protected synchronized void removeConnector(SearchResult result) throws Exception {
         String uuid = toUUID(result);
         if (!uuidMap.containsKey(uuid)) {
-            LOG.warn("connector not regsitered for UUID [" + uuid + "]");
+            LOG.warn("connector not registered for UUID [{}]", uuid);
             return;
         }
 
         URI connectorURI = uuidMap.get(uuid);
         if (!connectorMap.containsKey(connectorURI)) {
-            LOG.warn("connector not regisitered for URI [" + connectorURI + "]");
+            LOG.warn("connector not registered for URI [{}]", connectorURI);
             return;
         }
 
         int referenceCount = referenceMap.get(connectorURI) - 1;
         referenceMap.put(connectorURI, referenceCount);
         uuidMap.remove(uuid);
-        LOG.debug("connector referenced removed for URI [" + connectorURI + "], UUID [" + uuid + "], remaining reference(s) [" + referenceCount + "]");
+        LOG.debug("connector referenced removed for URI [{}], UUID[{}], remaining reference(s) [{}]", new Object[]{ connectorURI, uuid, referenceCount });
 
         if (referenceCount > 0) {
             return;
@@ -353,7 +353,7 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
 
         NetworkConnector connector = connectorMap.remove(connectorURI);
         connector.stop();
-        LOG.info("connector removed with URI [" + connectorURI + "]");
+        LOG.info("connector removed with URI [{}]", connectorURI);
     }
 
     /**
@@ -368,7 +368,7 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
         String port = (String) attributes.get("ipserviceport").get();
         String protocol = (String) attributes.get("ipserviceprotocol").get();
         URI connectorURI = new URI("static:(" + protocol + "://" + address + ":" + port + ")");
-        LOG.debug("retrieved URI from SearchResult [" + connectorURI + "]");
+        LOG.debug("retrieved URI from SearchResult [{}]", connectorURI);
         return connectorURI;
     }
 
@@ -380,7 +380,7 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
      */
     protected String toUUID(SearchResult result) {
         String uuid = result.getNameInNamespace();
-        LOG.debug("retrieved UUID from SearchResult [" + uuid + "]");
+        LOG.debug("retrieved UUID from SearchResult [{}]", uuid);
         return uuid;
     }
 
@@ -419,7 +419,7 @@ public class LdapNetworkConnector extends NetworkConnector implements NamespaceC
         String uuidNew = event.getNewBinding().getName();
         URI connectorURI = uuidMap.remove(uuidOld);
         uuidMap.put(uuidNew, connectorURI);
-        LOG.debug("connector reference renamed for URI [" + connectorURI + "], Old UUID [" + uuidOld + "], New UUID [" + uuidNew + "]");
+        LOG.debug("connector reference renamed for URI [{}], Old UUID [{}], New UUID [{}]", new Object[]{ connectorURI, uuidOld, uuidNew });
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/network/MBeanNetworkListener.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/MBeanNetworkListener.java b/activemq-broker/src/main/java/org/apache/activemq/network/MBeanNetworkListener.java
index cd7997e..c9a9935 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/network/MBeanNetworkListener.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/network/MBeanNetworkListener.java
@@ -55,11 +55,9 @@ public class MBeanNetworkListener implements NetworkBridgeListener {
             ObjectName objectName = createNetworkBridgeObjectName(bridge);
             AnnotatedMBean.registerMBean(brokerService.getManagementContext(), view, objectName);
             bridge.setMbeanObjectName(objectName);
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("registered: " + bridge + " as: " + objectName);
-            }
+            LOG.debug("registered: {} as: {}", bridge, objectName);
         } catch (Throwable e) {
-            LOG.debug("Network bridge could not be registered in JMX: " + e.getMessage(), e);
+            LOG.debug("Network bridge could not be registered in JMX: {}", e.getMessage(), e);
         }
     }
 
@@ -74,7 +72,7 @@ public class MBeanNetworkListener implements NetworkBridgeListener {
                 brokerService.getManagementContext().unregisterMBean(objectName);
             }
         } catch (Throwable e) {
-            LOG.debug("Network bridge could not be unregistered in JMX: " + e.getMessage(), e);
+            LOG.debug("Network bridge could not be unregistered in JMX: {}", e.getMessage(), e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java b/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java
index 808754f..597625c 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java
@@ -19,8 +19,6 @@ package org.apache.activemq.network;
 import org.apache.activemq.advisory.AdvisorySupport;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ConsumerInfo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -29,7 +27,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
  * Configuration for a NetworkBridge
  */
 public class NetworkBridgeConfiguration {
-    private static final Logger LOG = LoggerFactory.getLogger(NetworkBridgeConfiguration.class);
 
     private boolean conduitSubscriptions = true;
     private boolean dynamicOnly;

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/network/NetworkConnector.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/NetworkConnector.java b/activemq-broker/src/main/java/org/apache/activemq/network/NetworkConnector.java
index fd7dd2b..ffce8b8 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/network/NetworkConnector.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/network/NetworkConnector.java
@@ -168,11 +168,11 @@ public abstract class NetworkConnector extends NetworkBridgeConfiguration implem
         if (localURI == null) {
             throw new IllegalStateException("You must configure the 'localURI' property");
         }
-        LOG.info("Network Connector " + this + " Started");
+        LOG.info("Network Connector {} Started", this);
     }
 
     protected void handleStop(ServiceStopper stopper) throws Exception {
-        LOG.info("Network Connector " + this + " Stopped");
+        LOG.info("Network Connector {} Stopped", this);
     }
 
     public boolean isStarted() {
@@ -212,7 +212,7 @@ public abstract class NetworkConnector extends NetworkBridgeConfiguration implem
             ObjectName objectName = createNetworkBridgeObjectName(bridge);
             AnnotatedMBean.registerMBean(getBrokerService().getManagementContext(), view, objectName);
         } catch (Throwable e) {
-            LOG.debug("Network bridge could not be registered in JMX: " + e.getMessage(), e);
+            LOG.debug("Network bridge could not be registered in JMX: {}", e.getMessage(), e);
         }
     }
 
@@ -224,7 +224,7 @@ public abstract class NetworkConnector extends NetworkBridgeConfiguration implem
             ObjectName objectName = createNetworkBridgeObjectName(bridge);
             getBrokerService().getManagementContext().unregisterMBean(objectName);
         } catch (Throwable e) {
-            LOG.debug("Network bridge could not be unregistered in JMX: " + e.getMessage(), e);
+            LOG.debug("Network bridge could not be unregistered in JMX: {}", e.getMessage(), e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/network/jms/DestinationBridge.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/jms/DestinationBridge.java b/activemq-broker/src/main/java/org/apache/activemq/network/jms/DestinationBridge.java
index b206377..ff0f076 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/network/jms/DestinationBridge.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/network/jms/DestinationBridge.java
@@ -146,8 +146,7 @@ public abstract class DestinationBridge implements Service, MessageListener {
                 return;
 
             } catch (Exception e) {
-                LOG.info("failed to forward message on attempt: " + attempt +
-                         " reason: " + e + " message: " + message, e);
+                LOG.info("failed to forward message on attempt: {} reason: {} message: {}", new Object[]{ attempt, e, message }, e);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/network/jms/JmsConnector.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/jms/JmsConnector.java b/activemq-broker/src/main/java/org/apache/activemq/network/jms/JmsConnector.java
index 5abdf8b..f8f602b 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/network/jms/JmsConnector.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/network/jms/JmsConnector.java
@@ -89,9 +89,9 @@ public abstract class JmsConnector implements Service {
                     DestinationBridge bridge = (DestinationBridge)lru.getValue();
                     try {
                         bridge.stop();
-                        LOG.info("Expired bridge: " + bridge);
+                        LOG.info("Expired bridge: {}", bridge);
                     } catch (Exception e) {
-                        LOG.warn("stopping expired bridge" + bridge + " caused an exception", e);
+                        LOG.warn("stopping expired bridge {} caused an exception", bridge, e);
                     }
                 }
                 return false;
@@ -160,7 +160,7 @@ public abstract class JmsConnector implements Service {
             for (DestinationBridge bridge : outboundBridges) {
                 bridge.start();
             }
-            LOG.info("JMS Connector " + getName() + " Started");
+            LOG.info("JMS Connector {} Started", getName());
         }
     }
 
@@ -176,7 +176,7 @@ public abstract class JmsConnector implements Service {
             for (DestinationBridge bridge : outboundBridges) {
                 bridge.stop();
             }
-            LOG.info("JMS Connector " + getName() + " Stopped");
+            LOG.info("JMS Connector {} Stopped", getName());
         }
     }
 
@@ -475,7 +475,7 @@ public abstract class JmsConnector implements Service {
             return;
         }
 
-        LOG.info("JmsConnector handling loss of connection [" + connection.toString() + "]");
+        LOG.info("JmsConnector handling loss of connection [{}]", connection.toString());
 
         // TODO - How do we handle the re-wiring of replyToBridges in this case.
         replyToBridges.clear();
@@ -500,7 +500,7 @@ public abstract class JmsConnector implements Service {
                     try {
                         doInitializeConnection(false);
                     } catch (Exception e) {
-                        LOG.error("Failed to initialize forgein connection for the JMSConnector", e);
+                        LOG.error("Failed to initialize foreign connection for the JMSConnector", e);
                     }
                 }
             });
@@ -552,7 +552,7 @@ public abstract class JmsConnector implements Service {
                 try {
                     doInitializeConnection(false);
                 } catch (Exception e) {
-                    LOG.error("Failed to initialize forgein connection for the JMSConnector", e);
+                    LOG.error("Failed to initialize foreign connection for the JMSConnector", e);
                 }
             }
         });
@@ -606,8 +606,7 @@ public abstract class JmsConnector implements Service {
 
                 return;
             } catch(Exception e) {
-                LOG.debug("Failed to establish initial " + (local ? "local" : "foriegn") +
-                          " connection for JmsConnector [" + attempt + "]: " + e.getMessage());
+                LOG.debug("Failed to establish initial {} connection for JmsConnector [{}]", new Object[]{ (local ? "local" : "foreign"), attempt }, e);
             }
         }
         while (maxRetries < ++attempt && !connectionSerivce.isTerminating());

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/network/jms/SimpleJmsQueueConnector.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/jms/SimpleJmsQueueConnector.java b/activemq-broker/src/main/java/org/apache/activemq/network/jms/SimpleJmsQueueConnector.java
index 2825434..2d9a470 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/network/jms/SimpleJmsQueueConnector.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/network/jms/SimpleJmsQueueConnector.java
@@ -378,9 +378,9 @@ public class SimpleJmsQueueConnector extends JmsConnector {
                     }
                     bridge.setJmsConnector(this);
                     bridge.start();
-                    LOG.info("Created replyTo bridge for " + replyToProducerQueue);
+                    LOG.info("Created replyTo bridge for {}", replyToProducerQueue);
                 } catch (Exception e) {
-                    LOG.error("Failed to create replyTo bridge for queue: " + replyToProducerQueue, e);
+                    LOG.error("Failed to create replyTo bridge for queue: {}", replyToProducerQueue, e);
                     return null;
                 }
                 replyToBridges.put(replyToProducerQueue, bridge);
@@ -409,9 +409,9 @@ public class SimpleJmsQueueConnector extends JmsConnector {
                     }
                     bridge.setJmsConnector(this);
                     bridge.start();
-                    LOG.info("Created replyTo bridge for " + replyToProducerQueue);
+                    LOG.info("Created replyTo bridge for {}", replyToProducerQueue);
                 } catch (Exception e) {
-                    LOG.error("Failed to create replyTo bridge for queue: " + replyToProducerQueue, e);
+                    LOG.error("Failed to create replyTo bridge for queue: {}", replyToProducerQueue, e);
                     return null;
                 }
                 replyToBridges.put(replyToProducerQueue, bridge);

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/network/jms/SimpleJmsTopicConnector.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/jms/SimpleJmsTopicConnector.java b/activemq-broker/src/main/java/org/apache/activemq/network/jms/SimpleJmsTopicConnector.java
index b21a760..68d91c3 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/network/jms/SimpleJmsTopicConnector.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/network/jms/SimpleJmsTopicConnector.java
@@ -376,9 +376,9 @@ public class SimpleJmsTopicConnector extends JmsConnector {
                     }
                     bridge.setJmsConnector(this);
                     bridge.start();
-                    LOG.info("Created replyTo bridge for " + replyToProducerTopic);
+                    LOG.info("Created replyTo bridge for {}", replyToProducerTopic);
                 } catch (Exception e) {
-                    LOG.error("Failed to create replyTo bridge for topic: " + replyToProducerTopic, e);
+                    LOG.error("Failed to create replyTo bridge for topic: {}", replyToProducerTopic, e);
                     return null;
                 }
                 replyToBridges.put(replyToProducerTopic, bridge);
@@ -407,9 +407,9 @@ public class SimpleJmsTopicConnector extends JmsConnector {
                     }
                     bridge.setJmsConnector(this);
                     bridge.start();
-                    LOG.info("Created replyTo bridge for " + replyToProducerTopic);
+                    LOG.info("Created replyTo bridge for {}", replyToProducerTopic);
                 } catch (Exception e) {
-                    LOG.error("Failed to create replyTo bridge for topic: " + replyToProducerTopic, e);
+                    LOG.error("Failed to create replyTo bridge for topic: {}", replyToProducerTopic, e);
                     return null;
                 }
                 replyToBridges.put(replyToProducerTopic, bridge);

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/plugin/DiscardingDLQBroker.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/plugin/DiscardingDLQBroker.java b/activemq-broker/src/main/java/org/apache/activemq/plugin/DiscardingDLQBroker.java
index c31d0bb..f1b5fd9 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/plugin/DiscardingDLQBroker.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/plugin/DiscardingDLQBroker.java
@@ -45,9 +45,7 @@ public class DiscardingDLQBroker extends BrokerFilter {
 
     @Override
     public boolean sendToDeadLetterQueue(ConnectionContext ctx, MessageReference msgRef, Subscription subscription, Throwable poisonCause) {
-        if (log.isTraceEnabled()) {
-            log.trace("Discarding DLQ BrokerFilter[pass through] - skipping message:" + (msgRef != null ? msgRef.getMessage() : null));
-        }
+        log.trace("Discarding DLQ BrokerFilter[pass through] - skipping message: {}", (msgRef != null ? msgRef.getMessage() : null));
         boolean dropped = true;
         Message msg = null;
         ActiveMQDestination dest = null;
@@ -78,7 +76,7 @@ public class DiscardingDLQBroker extends BrokerFilter {
 
         if (dropped && getReportInterval() > 0) {
             if ((++dropCount) % getReportInterval() == 0) {
-                log.info("Total of " + dropCount + " messages were discarded, since their destination was the dead letter queue");
+                log.info("Total of {} messages were discarded, since their destination was the dead letter queue", dropCount);
             }
         }
 
@@ -95,10 +93,7 @@ public class DiscardingDLQBroker extends BrokerFilter {
     }
 
     private void skipMessage(String prefix, MessageReference msgRef) {
-        if (log.isDebugEnabled()) {
-            String lmsg = "Discarding DLQ BrokerFilter[" + prefix + "] - skipping message:" + (msgRef != null ? msgRef.getMessage() : null);
-            log.debug(lmsg);
-        }
+        log.debug("Discarding DLQ BrokerFilter[{}] - skipping message: {}", prefix, (msgRef != null ? msgRef.getMessage() : null));
     }
 
     public void setDropTemporaryTopics(boolean dropTemporaryTopics) {

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/plugin/DiscardingDLQBrokerPlugin.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/plugin/DiscardingDLQBrokerPlugin.java b/activemq-broker/src/main/java/org/apache/activemq/plugin/DiscardingDLQBrokerPlugin.java
index ef45788..343bb15 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/plugin/DiscardingDLQBrokerPlugin.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/plugin/DiscardingDLQBrokerPlugin.java
@@ -26,7 +26,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * @author Filip Hanik
  * @org.apache.xbean.XBean element="discardingDLQBrokerPlugin"
  * @version 1.0
  */
@@ -49,10 +48,9 @@ public class DiscardingDLQBrokerPlugin implements BrokerPlugin {
      * @todo Implement this org.apache.activemq.broker.BrokerPlugin method
      */
     public Broker installPlugin(Broker broker) throws Exception {
-        log.info("Installing Discarding Dead Letter Queue broker plugin[dropAll="+isDropAll()+
-                 "; dropTemporaryTopics="+isDropTemporaryTopics()+"; dropTemporaryQueues="+
-                 isDropTemporaryQueues()+"; dropOnly="+getDropOnly()+"; reportInterval="+
-                 getReportInterval()+"]");
+        log.info("Installing Discarding Dead Letter Queue broker plugin[dropAll={}; dropTemporaryTopics={}; dropTemporaryQueues={}; dropOnly={}; reportInterval={}]", new Object[]{
+                isDropAll(), isDropTemporaryTopics(), isDropTemporaryQueues(), getDropOnly(), reportInterval
+        });
         DiscardingDLQBroker cb = new DiscardingDLQBroker(broker);
         cb.setDropAll(isDropAll());
         cb.setDropTemporaryQueues(isDropTemporaryQueues());

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/plugin/ForcePersistencyModeBrokerPlugin.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/plugin/ForcePersistencyModeBrokerPlugin.java b/activemq-broker/src/main/java/org/apache/activemq/plugin/ForcePersistencyModeBrokerPlugin.java
index 2393a40..5b6d6e4 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/plugin/ForcePersistencyModeBrokerPlugin.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/plugin/ForcePersistencyModeBrokerPlugin.java
@@ -50,7 +50,7 @@ public ForcePersistencyModeBrokerPlugin() {
   public Broker installPlugin(Broker broker) throws Exception{
     ForcePersistencyModeBroker pB = new ForcePersistencyModeBroker(broker);
     pB.setPersistenceFlag(isPersistenceForced());
-    LOG.info("Installing ForcePersistencyModeBroker plugin: persistency enforced=" + pB.isPersistent());
+    LOG.info("Installing ForcePersistencyModeBroker plugin: persistency enforced={}", pB.isPersistent());
     return pB;
   }
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/plugin/SubQueueSelectorCacheBroker.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/plugin/SubQueueSelectorCacheBroker.java b/activemq-broker/src/main/java/org/apache/activemq/plugin/SubQueueSelectorCacheBroker.java
index 48efde0..cfa50f7 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/plugin/SubQueueSelectorCacheBroker.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/plugin/SubQueueSelectorCacheBroker.java
@@ -66,7 +66,7 @@ public class SubQueueSelectorCacheBroker extends BrokerFilter implements Runnabl
     public SubQueueSelectorCacheBroker(Broker next, final File persistFile) {
         super(next);
         this.persistFile = persistFile;
-        LOG.info("Using persisted selector cache from[" + persistFile + "]");
+        LOG.info("Using persisted selector cache from[{}]", persistFile);
 
         readCache();
 
@@ -85,7 +85,7 @@ public class SubQueueSelectorCacheBroker extends BrokerFilter implements Runnabl
 
     @Override
     public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
-        LOG.debug("Caching consumer selector [" + info.getSelector() + "] on a " + info.getDestination().getQualifiedName());
+        LOG.debug("Caching consumer selector [{}] on a {}", info.getSelector(), info.getDestination().getQualifiedName());
         String selector = info.getSelector();
 
         // As ConcurrentHashMap doesn't support null values, use always true expression
@@ -141,7 +141,7 @@ public class SubQueueSelectorCacheBroker extends BrokerFilter implements Runnabl
                 fos.close();
             } //try
         } catch (IOException ex) {
-            LOG.error("Unable to access file[" + persistFile + "]", ex);
+            LOG.error("Unable to access file[{}]", persistFile, ex);
         } //try
     }
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/proxy/ProxyConnection.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/proxy/ProxyConnection.java b/activemq-broker/src/main/java/org/apache/activemq/proxy/ProxyConnection.java
index c7da81a..789dbbf 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/proxy/ProxyConnection.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/proxy/ProxyConnection.java
@@ -45,7 +45,7 @@ class ProxyConnection implements Service {
 
     public void onFailure(IOException e) {
         if (!shuttingDown.get()) {
-            LOG.debug("Transport error: " + e, e);
+            LOG.debug("Transport error: {}", e.getMessage(), e);
             try {
                 stop();
             } catch (Exception ignore) {

http://git-wip-us.apache.org/repos/asf/activemq/blob/e1bbde73/activemq-broker/src/main/java/org/apache/activemq/proxy/ProxyConnector.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/proxy/ProxyConnector.java b/activemq-broker/src/main/java/org/apache/activemq/proxy/ProxyConnector.java
index e47877d..bf10bfe 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/proxy/ProxyConnector.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/proxy/ProxyConnector.java
@@ -67,11 +67,11 @@ public class ProxyConnector implements Service {
             }
 
             public void onAcceptError(Exception error) {
-                LOG.error("Could not accept connection: " + error, error);
+                LOG.error("Could not accept connection: ", error);
             }
         });
         getServer().start();
-        LOG.info("Proxy Connector " + getName() + " Started");
+        LOG.info("Proxy Connector {} Started", getName());
 
     }
 
@@ -85,7 +85,7 @@ public class ProxyConnector implements Service {
             ss.stop(iter.next());
         }
         ss.throwFirstException();
-        LOG.info("Proxy Connector " + getName() + " Stopped");
+        LOG.info("Proxy Connector {} Stopped", getName());
     }
 
     // Properties


Mime
View raw message