diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/Span.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/Span.java index fd79562a7..4fe24b6e4 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/Span.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/Span.java @@ -377,7 +377,7 @@ public class Span { @Override public String toString() { return "[Trace: " + idToHex(this.traceId) + ", Span: " + idToHex(this.spanId) - + ", Parent: " + getParentIdIfPresent() + ", exportable=" + this.exportable + "]"; + + ", Parent: " + getParentIdIfPresent() + ", exportable:" + this.exportable + "]"; } private String getParentIdIfPresent() { diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceFilter.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceFilter.java index 41be7dd8c..74fd57c62 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceFilter.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceFilter.java @@ -129,17 +129,17 @@ public class TraceFilter extends GenericFilterBean { Span spanFromRequest = getSpanFromAttribute(request); if (spanFromRequest != null) { this.tracer.continueSpan(spanFromRequest); - if (log.isTraceEnabled()) { - log.trace("There has already been a span in the request " + spanFromRequest + ""); + if (log.isDebugEnabled()) { + log.debug("There has already been a span in the request " + spanFromRequest + ""); } } - if (log.isTraceEnabled()) { - log.trace("Received a request to uri [" + uri + "] that matches the should be skipped [" + skip + "]"); + if (log.isDebugEnabled()) { + log.debug("Received a request to uri [" + uri + "] that should be skipped [" + skip + "]"); } // in case of a response with exception status a exception controller will close the span if (!httpStatusSuccessful(response) && isSpanContinued(request)) { - if (log.isTraceEnabled()) { - log.trace( + if (log.isDebugEnabled()) { + log.debug( "The span was already detached once and we're processing an error"); } try { @@ -166,8 +166,8 @@ public class TraceFilter extends GenericFilterBean { } finally { if (isAsyncStarted(request) || request.isAsyncStarted()) { - if (log.isTraceEnabled()) { - log.trace("Detaching the span " + spanFromRequest + " since the request is asynchronous"); + if (log.isDebugEnabled()) { + log.debug("Detaching the span " + spanFromRequest + " since the request is asynchronous"); } this.tracer.detach(spanFromRequest); // TODO: how to deal with response annotations and async? @@ -179,8 +179,8 @@ public class TraceFilter extends GenericFilterBean { if (spanFromRequest.hasSavedSpan()) { Span parent = spanFromRequest.getSavedSpan(); if (parent.isRemote()) { - if (log.isTraceEnabled()) { - log.trace("Sending the parent span " + parent + " to Zipkin"); + if (log.isDebugEnabled()) { + log.debug("Sending the parent span " + parent + " to Zipkin"); } parent.logEvent(Span.SERVER_SEND); parent.stop(); @@ -191,18 +191,18 @@ public class TraceFilter extends GenericFilterBean { } // in case of a response with exception status will close the span when exception dispatch is handled if (httpStatusSuccessful(response)) { - if (log.isTraceEnabled()) { - log.trace("Closing the span " + spanFromRequest + " since the response was successful"); + if (log.isDebugEnabled()) { + log.debug("Closing the span " + spanFromRequest + " since the response was successful"); } this.tracer.close(spanFromRequest); } else if (errorAlreadyHandled(request)) { - if (log.isTraceEnabled()) { - log.trace( + if (log.isDebugEnabled()) { + log.debug( "Won't detach the span since error has already been handled"); } } else { - if (log.isTraceEnabled()) { - log.trace("Detaching the span " + spanFromRequest + " since the response was unsuccessful"); + if (log.isDebugEnabled()) { + log.debug("Detaching the span " + spanFromRequest + " since the response was unsuccessful"); } this.tracer.detach(spanFromRequest); } @@ -240,27 +240,27 @@ public class TraceFilter extends GenericFilterBean { private Span createSpan(HttpServletRequest request, boolean skip, Span spanFromRequest, String name) { if (spanFromRequest != null) { - if (log.isTraceEnabled()) { - log.trace("Span has already been created - continuing with the previous one"); + if (log.isDebugEnabled()) { + log.debug("Span has already been created - continuing with the previous one"); } return spanFromRequest; } Span parent = this.spanExtractor.joinTrace(request); if (parent != null) { - if (log.isTraceEnabled()) { - log.trace("Found a parent span " + parent + " in the request"); + if (log.isDebugEnabled()) { + log.debug("Found a parent span " + parent + " in the request"); } addRequestTagsForParentSpan(request, parent); spanFromRequest = this.tracer.createSpan(name, parent); - if (log.isTraceEnabled()) { - log.trace("Started a new span " + spanFromRequest + " with parent " + parent); + if (log.isDebugEnabled()) { + log.debug("Started a new span " + spanFromRequest + " with parent " + parent); } if (parent.isRemote()) { parent.logEvent(Span.SERVER_RECV); } request.setAttribute(TRACE_REQUEST_ATTR, spanFromRequest); - if (log.isTraceEnabled()) { - log.trace("Parent span is " + parent + ""); + if (log.isDebugEnabled()) { + log.debug("Parent span is " + parent + ""); } } else { @@ -272,7 +272,7 @@ public class TraceFilter extends GenericFilterBean { } spanFromRequest.logEvent(Span.SERVER_RECV); request.setAttribute(TRACE_REQUEST_ATTR, spanFromRequest); - log.trace("No parent span present - creating a new span"); + log.debug("No parent span present - creating a new span"); } return spanFromRequest; } diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/AbstractTraceHttpRequestInterceptor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/AbstractTraceHttpRequestInterceptor.java index 2abc5a033..413cf88f7 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/AbstractTraceHttpRequestInterceptor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/AbstractTraceHttpRequestInterceptor.java @@ -59,8 +59,8 @@ abstract class AbstractTraceHttpRequestInterceptor { this.spanInjector.inject(newSpan, request); addRequestTags(request); newSpan.logEvent(Span.CLIENT_SEND); - if (log.isTraceEnabled()) { - log.trace("Starting new client span [" + newSpan + "]"); + if (log.isDebugEnabled()) { + log.debug("Starting new client span [" + newSpan + "]"); } } diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRestTemplateInterceptor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRestTemplateInterceptor.java index 93ee4f98a..8eda2fbc4 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRestTemplateInterceptor.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/client/TraceRestTemplateInterceptor.java @@ -56,8 +56,8 @@ public class TraceRestTemplateInterceptor extends AbstractTraceHttpRequestInterc try { return new TraceHttpResponse(this, execution.execute(request, body)); } catch (Exception e) { - if (log.isTraceEnabled()) { - log.trace("Exception occurred while trying to execute the request", e); + if (log.isDebugEnabled()) { + log.debug("Exception occurred while trying to execute the request. Will close the span [" + currentSpan() + "]", e); } this.tracer.close(currentSpan()); throw e; diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TracePostZuulFilter.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TracePostZuulFilter.java index 4c91cf1af..08ce2eb41 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TracePostZuulFilter.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TracePostZuulFilter.java @@ -54,8 +54,8 @@ public class TracePostZuulFilter extends ZuulFilter { public Object run() { // TODO: the client sent event should come from the client not the filter! getCurrentSpan().logEvent(Span.CLIENT_RECV); - if (log.isTraceEnabled()) { - log.trace("Closing current client span " + getCurrentSpan() + ""); + if (log.isDebugEnabled()) { + log.debug("Closing current client span " + getCurrentSpan() + ""); } this.tracer.addTag(this.traceKeys.getHttp().getStatusCode(), String.valueOf(RequestContext.getCurrentContext().getResponse().getStatus())); diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TracePreZuulFilter.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TracePreZuulFilter.java index bdc7db600..2717d5b9a 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TracePreZuulFilter.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TracePreZuulFilter.java @@ -70,23 +70,23 @@ public class TracePreZuulFilter extends ZuulFilter { public ZuulFilterResult runFilter() { RequestContext ctx = RequestContext.getCurrentContext(); Span span = getCurrentSpan(); - if (log.isTraceEnabled()) { - log.trace("Current span is " + span + ""); + if (log.isDebugEnabled()) { + log.debug("Current span is " + span + ""); } Span newSpan = this.tracer.createSpan(span.getName(), span); newSpan.tag(Span.SPAN_LOCAL_COMPONENT_TAG_NAME, ZUUL_COMPONENT); this.spanInjector.inject(newSpan, ctx); this.httpTraceKeysInjector.addRequestTags(newSpan, URI.create(ctx.getRequest().getRequestURI()), ctx.getRequest().getMethod()); - if (log.isTraceEnabled()) { - log.trace("New Zuul Span is " + newSpan + ""); + if (log.isDebugEnabled()) { + log.debug("New Zuul Span is " + newSpan + ""); } ZuulFilterResult result = super.runFilter(); - if (log.isTraceEnabled()) { - log.trace("Result of Zuul filter is [" + result.getStatus() + "]"); + if (log.isDebugEnabled()) { + log.debug("Result of Zuul filter is [" + result.getStatus() + "]"); } if (ExecutionStatus.SUCCESS != result.getStatus()) { - if (log.isTraceEnabled()) { - log.trace("The result of Zuul filter execution was not successful thus " + if (log.isDebugEnabled()) { + log.debug("The result of Zuul filter execution was not successful thus " + "will close the current span " + newSpan); } this.tracer.close(newSpan); diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceRestClientRibbonCommandFactory.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceRestClientRibbonCommandFactory.java index a6971170e..e8923de1f 100644 --- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceRestClientRibbonCommandFactory.java +++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/zuul/TraceRestClientRibbonCommandFactory.java @@ -101,8 +101,8 @@ public class TraceRestClientRibbonCommandFactory extends RestClientRibbonCommand this.spanInjector.inject(span, requestBuilder); this.httpTraceKeysInjector.addRequestTags(span, getUri(), getVerb().verb()); span.logEvent(Span.CLIENT_SEND); - if (log.isTraceEnabled()) { - log.trace("Span from RibbonCommandFactory is " + span); + if (log.isDebugEnabled()) { + log.debug("Span in RibbonCommandFactory is" + span); } }