camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r952904 - in /camel/trunk/camel-core/src/main/java/org/apache/camel/impl: DefaultCamelContext.java converter/DefaultTypeConverter.java
Date Wed, 09 Jun 2010 05:10:38 GMT
Author: davsclaus
Date: Wed Jun  9 05:10:38 2010
New Revision: 952904

URL: http://svn.apache.org/viewvc?rev=952904&view=rev
Log:
CAMEL-2628: Output duration in more human reable format for time taken to start/stop Camel.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=952904&r1=952903&r2=952904&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java Wed
Jun  9 05:10:38 2010
@@ -1031,9 +1031,11 @@ public class DefaultCamelContext extends
             }
         }
 
-        LOG.info("Started " + getRoutes().size() + " routes");
-
-        LOG.info("Apache Camel " + getVersion() + " (CamelContext: " + getName() + ") started
in " + stopWatch.stop() + " millis");
+        stopWatch.stop();
+        if (LOG.isInfoEnabled()) {
+            LOG.info("Started " + getRoutes().size() + " routes");
+            LOG.info("Apache Camel " + getVersion() + " (CamelContext: " + getName() + ")
started in " + TimeUtils.printDuration(stopWatch.taken()));
+        }
         EventHelper.notifyCamelContextStarted(this);
     }
 
@@ -1165,11 +1167,14 @@ public class DefaultCamelContext extends
         // shutdown management as the last one
         shutdownServices(managementStrategy);
 
-        LOG.info("Uptime: " + getUptime());
+        stopWatch.stop();
+        if (LOG.isInfoEnabled()) {
+            LOG.info("Uptime: " + getUptime());
+            LOG.info("Apache Camel " + getVersion() + " (CamelContext: " + getName() + ")
is shutdown in " + TimeUtils.printDuration(stopWatch.taken()));
+        }
+
         // and clear start date
         startDate = null;
-
-        LOG.info("Apache Camel " + getVersion() + " (CamelContext: " + getName() + ") is
shutdown in " + stopWatch.stop() + " millis");
     }
 
     private void shutdownServices(Object service) {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java?rev=952904&r1=952903&r2=952904&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
Wed Jun  9 05:10:38 2010
@@ -39,6 +39,7 @@ import org.apache.camel.spi.TypeConverte
 import org.apache.camel.spi.TypeConverterRegistry;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.StopWatch;
+import org.apache.camel.util.TimeUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -387,7 +388,9 @@ public class DefaultTypeConverter extend
         LOG.debug("Loading type converters done");
 
         // report how long time it took to load
-        LOG.info("Loaded " + typeMappings.size() + " type converters in " + watch.stop()
+ " millis");
+        if (LOG.isInfoEnabled()) {
+            LOG.info("Loaded " + typeMappings.size() + " type converters in " + TimeUtils.printDuration(watch.stop()));
+        }
     }
 
     protected void loadFallbackTypeConverters() throws IOException, ClassNotFoundException
{



Mime
View raw message