camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [2/2] git commit: CAMEL-6694 Fixed CS error and Polish the code
Date Fri, 04 Apr 2014 13:36:51 GMT
CAMEL-6694 Fixed CS error and Polish the code


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2ab36a3d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2ab36a3d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2ab36a3d

Branch: refs/heads/master
Commit: 2ab36a3db9520001d05c87cd779433165d0c6168
Parents: dba21eb
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Fri Apr 4 21:36:25 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Fri Apr 4 21:36:25 2014 +0800

----------------------------------------------------------------------
 .../java/org/apache/camel/component/log/LogComponent.java |  2 --
 .../main/java/org/apache/camel/model/LogDefinition.java   | 10 +++++++---
 .../processor/LogProcessorWithProvidedLoggerTest.java     |  6 ++----
 3 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2ab36a3d/camel-core/src/main/java/org/apache/camel/component/log/LogComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/log/LogComponent.java b/camel-core/src/main/java/org/apache/camel/component/log/LogComponent.java
index 5eebc25..c24189c 100644
--- a/camel-core/src/main/java/org/apache/camel/component/log/LogComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/log/LogComponent.java
@@ -22,13 +22,11 @@ import java.util.Map;
 import org.apache.camel.Endpoint;
 import org.apache.camel.LoggingLevel;
 import org.apache.camel.Processor;
-import org.apache.camel.ResolveEndpointFailedException;
 import org.apache.camel.impl.UriEndpointComponent;
 import org.apache.camel.processor.CamelLogProcessor;
 import org.apache.camel.processor.DefaultExchangeFormatter;
 import org.apache.camel.processor.ThroughputLogger;
 import org.apache.camel.spi.ExchangeFormatter;
-import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.util.CamelLogger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/camel/blob/2ab36a3d/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java b/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java
index 085d0ce..a49c5bb 100644
--- a/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.model;
 
+import java.util.Map;
+
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
@@ -26,6 +28,7 @@ import org.apache.camel.Expression;
 import org.apache.camel.LoggingLevel;
 import org.apache.camel.Processor;
 import org.apache.camel.processor.LogProcessor;
+import org.apache.camel.processor.aggregate.AggregateProcessor;
 import org.apache.camel.spi.RouteContext;
 import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.util.CamelLogger;
@@ -33,8 +36,6 @@ import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Map;
-
 /**
  * Represents an XML &lt;log/&gt; element
  *
@@ -43,6 +44,8 @@ import java.util.Map;
 @XmlRootElement(name = "log")
 @XmlAccessorType(XmlAccessType.FIELD)
 public class LogDefinition extends NoOutputDefinition<LogDefinition> {
+    @XmlTransient
+    private static final Logger LOG = LoggerFactory.getLogger(LogDefinition.class);
     @XmlAttribute(required = true)
     private String message;
     @XmlAttribute
@@ -100,7 +103,7 @@ public class LogDefinition extends NoOutputDefinition<LogDefinition>
{
                 logger = availableLoggers.values().iterator().next();
             } else if (availableLoggers.size() > 1) {
                 // we should log about this somewhere...
-                //LOG.info("More than one {} instance found in the registry. Falling back
to creating logger by name.", Logger.class.getName());
+                LOG.info("More than one {} instance found in the registry. Falling back to
create logger by name.", Logger.class.getName());
             }
         }
 
@@ -108,6 +111,7 @@ public class LogDefinition extends NoOutputDefinition<LogDefinition>
{
             String name = getLogName();
             if (name == null) {
                 name = routeContext.getRoute().getId();
+                LOG.info("The LogName is null. Falling back to create logger by using the
route id {}.", name);
             }
             logger = LoggerFactory.getLogger(name);
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/2ab36a3d/camel-core/src/test/java/org/apache/camel/processor/LogProcessorWithProvidedLoggerTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/LogProcessorWithProvidedLoggerTest.java
b/camel-core/src/test/java/org/apache/camel/processor/LogProcessorWithProvidedLoggerTest.java
index 4aa000e..ae93b54 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/LogProcessorWithProvidedLoggerTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/LogProcessorWithProvidedLoggerTest.java
@@ -16,11 +16,12 @@
  */
 package org.apache.camel.processor;
 
+import java.io.StringWriter;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.LoggingLevel;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.log.LogComponent;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.SimpleRegistry;
 import org.apache.log4j.AppenderSkeleton;
@@ -30,9 +31,6 @@ import org.apache.log4j.spi.LoggingEvent;
 import org.junit.Before;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.io.StringWriter;
-
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertThat;
 


Mime
View raw message