Skip to content

Commit

Permalink
improvements for CAMEL-619 to avoid showing null nodeID and to show t…
Browse files Browse the repository at this point in the history
…he body java class too

git-svn-id: https://svn.apache.org/repos/asf/activemq/camel/trunk@671914 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
jstrachan committed Jun 26, 2008
1 parent a7a75d0 commit f0a68bd
Showing 1 changed file with 12 additions and 1 deletion.
Expand Up @@ -18,6 +18,7 @@

import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.spi.UnitOfWork;

/**
Expand All @@ -30,6 +31,7 @@ public class TraceFormatter {
private boolean showProperties = true;
private boolean showHeaders = true;
private boolean showBody = true;
private boolean showBodyType = true;

public Object format(TraceInterceptor interceptor, Exchange exchange) {
Message in = exchange.getIn();
Expand All @@ -41,6 +43,7 @@ public Object format(TraceInterceptor interceptor, Exchange exchange) {
+ (showExchangeId ? " Id: " + exchange.getExchangeId() : "")
+ (showProperties ? " Properties:" + exchange.getProperties() : "")
+ (showHeaders ? " Headers:" + in.getHeaders() : "")
+ (showBodyType ? " BodyType:" + ObjectHelper.className(in.getBody()) : "")
+ (showBody ? " Body:" + getBodyAsString(in) : "")
+ (exception != null ? " Exception: " + exception : "");
}
Expand All @@ -53,6 +56,14 @@ public void setShowBody(boolean showBody) {
this.showBody = showBody;
}

public boolean isShowBodyType() {
return showBodyType;
}

public void setShowBodyType(boolean showBodyType) {
this.showBodyType = showBodyType;
}

public boolean isShowBreadCrumb() {
return showBreadCrumb;
}
Expand Down Expand Up @@ -109,7 +120,7 @@ protected Object getBodyAsString(Message in) {
}

protected String getNodeMessage(TraceInterceptor interceptor) {
return interceptor.getNode().getId();
return interceptor.getNode().idOrCreate();
}

}

0 comments on commit f0a68bd

Please sign in to comment.