diff --git a/htrace-core4/src/main/java/org/apache/htrace/core/Tracer.java b/htrace-core4/src/main/java/org/apache/htrace/core/Tracer.java index 39d972d..a4de1d3 100644 --- a/htrace-core4/src/main/java/org/apache/htrace/core/Tracer.java +++ b/htrace-core4/src/main/java/org/apache/htrace/core/Tracer.java @@ -196,15 +196,16 @@ public class Tracer implements Closeable { TraceScope pushNewScope(Tracer tracer, Span span, TraceScope parentScope) { TraceScope scope = new TraceScope(tracer, span, parentScope); + if (LOG.isTraceEnabled()) LOG.trace("Pushing " + scope, new Exception()); threadLocalScope.set(scope); depth++; return scope; } void popScope() { + if (LOG.isTraceEnabled()) LOG.trace("Popping", new Exception()); if (depth <= 0) { - throwClientError("There were more trace scopes closed than " + - "were opened."); + throwClientError("There were more trace scopes closed than were opened."); } depth--; } @@ -565,7 +566,8 @@ public class Tracer implements Closeable { if (curScope != scope) { throwClientError("Can't detach TraceScope for " + scope.getSpan().toJson() + " because it is not the current " + - "TraceScope in thread " + Thread.currentThread().getName()); + "TraceScope, " + curScope.getSpan().toJson() + ", in thread " + + Thread.currentThread().getName()); } ThreadContext context = threadContext.get(); context.popScope(); @@ -585,7 +587,8 @@ public class Tracer implements Closeable { if (curScope != scope) { throwClientError("Can't close TraceScope for " + scope.getSpan().toJson() + " because it is not the current " + - "TraceScope in thread " + Thread.currentThread().getName()); + "TraceScope, " + curScope.getSpan().toJson() + ", in thread " + + Thread.currentThread().getName()); } if (tracerPool == null) { throwClientError(toString() + " is closed."); @@ -669,5 +672,4 @@ public class Tracer implements Closeable { public String toString() { return "Tracer(" + tracerId + ")"; } - -} +} \ No newline at end of file