You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by da...@apache.org on 2012/09/14 12:34:55 UTC

svn commit: r1384714 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java

Author: davsclaus
Date: Fri Sep 14 10:34:54 2012
New Revision: 1384714

URL: http://svn.apache.org/viewvc?rev=1384714&view=rev
Log:
AMQ-4049: Polished the AMQ start and stop logging.

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=1384714&r1=1384713&r2=1384714&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java Fri Sep 14 10:34:54 2012
@@ -578,13 +578,13 @@ public class BrokerService implements Se
             startBroker(startAsync);
             brokerRegistry.bind(getBrokerName(), BrokerService.this);
         } catch (Exception e) {
-            LOG.error("Failed to start ActiveMQ JMS Message Broker (" + getBrokerName() + ", " + brokerId + "). Reason: " + e, e);
+            LOG.error("Failed to start Apache ActiveMQ (" + getBrokerName() + ", " + brokerId + "). Reason: " + e, e);
             try {
                 if (!stopped.get()) {
                     stop();
                 }
             } catch (Exception ex) {
-                LOG.warn("Failed to stop broker after failure in start ", ex);
+                LOG.warn("Failed to stop broker after failure in start. This exception will be ignored.", ex);
             }
             throw e;
         } finally {
@@ -650,7 +650,17 @@ public class BrokerService implements Se
         slave = false;
         startDestinations();
         addShutdownHook();
-        getBroker().start();
+
+        broker = getBroker();
+        brokerId = broker.getBrokerId();
+
+        // need to log this after creating the broker so we have its id and name
+        if (LOG.isInfoEnabled()) {
+            LOG.info("Apache ActiveMQ " + getBrokerVersion() + " ("
+                    + getBrokerName() + ", " + brokerId + ") is starting");
+        }
+        broker.start();
+
         if (isUseJmx()) {
             if (getManagementContext().isCreateConnector() && !getManagementContext().isConnectorStarted()) {
                 // try to restart management context
@@ -678,16 +688,14 @@ public class BrokerService implements Se
                 registerFTConnectorMBean(masterConnector);
             }
         }
-        if (brokerId == null) {
-            brokerId = broker.getBrokerId();
-        }
         if (ioExceptionHandler == null) {
             setIoExceptionHandler(new DefaultIOExceptionHandler());
         }
 
         if (LOG.isInfoEnabled()) {
-            LOG.info("ActiveMQ " + getBrokerVersion() + " JMS Message Broker ("
+            LOG.info("Apache ActiveMQ " + getBrokerVersion() + " ("
                     + getBrokerName() + ", " + brokerId + ") started");
+            LOG.info("For help or more information please see: http://activemq.apache.org");
         }
 
         getBroker().brokerServiceStarted();
@@ -719,7 +727,7 @@ public class BrokerService implements Se
         }
 
         if (LOG.isInfoEnabled()) {
-            LOG.info("ActiveMQ " + getBrokerVersion() + " JMS Message Broker ("
+            LOG.info("Apache ActiveMQ " + getBrokerVersion() + " ("
                     + getBrokerName() + ", " + brokerId + ") is shutting down");
         }
 
@@ -795,9 +803,10 @@ public class BrokerService implements Se
 
         if (LOG.isInfoEnabled()) {
             if (startDate != null) {
-                LOG.info("Uptime {}", getUptime());
+                LOG.info("Apache ActiveMQ " + getBrokerVersion() + " ("
+                        + getBrokerName() + ", " + brokerId + ") uptime " + getUptime());
             }
-            LOG.info("ActiveMQ " + getBrokerVersion() + " JMS Message Broker ("
+            LOG.info("Apache ActiveMQ " + getBrokerVersion() + " ("
                     + getBrokerName() + ", " + brokerId + ") is shutdown");
         }
 
@@ -929,11 +938,6 @@ public class BrokerService implements Se
      */
     public Broker getBroker() throws Exception {
         if (broker == null) {
-            if (LOG.isInfoEnabled()) {
-                LOG.info("ActiveMQ " + getBrokerVersion() + " JMS Message Broker ("
-                        + getBrokerName() + ") is starting");
-                LOG.info("For help or more information please see: http://activemq.apache.org/");
-            }
             broker = createBroker();
         }
         return broker;