Repository: cxf Updated Branches: refs/heads/master de61a48bf -> 8868b8173
CXF-7129: Provide an optional HTrace Logback span converter to enrich log records with tracing details (minor format changes). Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/8868b817 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/8868b817 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/8868b817 Branch: refs/heads/master Commit: 8868b81733e184f914acba1c7cef5f88021084da Parents: de61a48 Author: reta <[email protected]> Authored: Mon Mar 13 21:24:58 2017 -0400 Committer: reta <[email protected]> Committed: Mon Mar 13 21:24:58 2017 -0400 ---------------------------------------------------------------------- .../tracing/htrace/ext/LogbackSpanConverter.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/8868b817/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/tracing/htrace/ext/LogbackSpanConverter.java ---------------------------------------------------------------------- diff --git a/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/tracing/htrace/ext/LogbackSpanConverter.java b/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/tracing/htrace/ext/LogbackSpanConverter.java index ec8f772..d0d84fb 100644 --- a/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/tracing/htrace/ext/LogbackSpanConverter.java +++ b/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/tracing/htrace/ext/LogbackSpanConverter.java @@ -39,17 +39,16 @@ import ch.qos.logback.classic.spi.ILoggingEvent; * * Which produces the following sample output: * - * [INFO] [spanId: -, tracerId: -] 2017-03-11 14:40:13.603 org.eclipse.jetty.server.Server Started @2731ms - * [INFO] [spanId: 6d3e0d975d4c883cce12aee1fd8f3e7e, tracerId: tracer-server/192.168.0.101] 2017-03-11 14:40:24.013 + * [INFO] [-, -] 2017-03-11 14:40:13.603 org.eclipse.jetty.server.Server Started @2731ms + * [INFO] [tracer-server/192.168.0.101, span: 6d3e0d975d4c883cce12aee1fd8f3e7e] 2017-03-11 14:40:24.013 * com.example.rs.PeopleRestService Getting all employees - * [INFO] [spanId: 6d3e0d975d4c883c7592f4c2317dec22, tracerId: tracer-server/192.168.0.101] 2017-03-11 14:40:28.017 + * [INFO] [tracer-server/192.168.0.101, span: 6d3e0d975d4c883c7592f4c2317dec22] 2017-03-11 14:40:28.017 * com.example.rs.PeopleRestService Looking up manager in the DB database * */ public class LogbackSpanConverter extends ClassicConverter { - private static final String TRACER_ID = "tracerId"; - private static final String SPAN_ID = "spanId"; - private static final String EMPTY_TRACE = String.format("%s: -, %s: -", SPAN_ID, TRACER_ID); + private static final String SPAN = "span"; + private static final String EMPTY_TRACE = "-, -"; @Override public String convert(ILoggingEvent event) { @@ -57,13 +56,11 @@ public class LogbackSpanConverter extends ClassicConverter { if (currentSpan != null) { return new StringBuilder() - .append(SPAN_ID) - .append(": ") - .append(currentSpan.getSpanId()) + .append(currentSpan.getTracerId()) .append(", ") - .append(TRACER_ID) + .append(SPAN) .append(": ") - .append(currentSpan.getTracerId()) + .append(currentSpan.getSpanId()) .toString(); }
