cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cxf git commit: CXF-7129: Provide an optional HTrace Logging receiver
Date Fri, 24 Feb 2017 01:08:49 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 1d2f39990 -> 9f54ff897


CXF-7129: Provide an optional HTrace Logging receiver


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/9f54ff89
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9f54ff89
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9f54ff89

Branch: refs/heads/master
Commit: 9f54ff897cbfc24b086c930578a07db6ad32fba6
Parents: 1d2f399
Author: reta <drreta@gmail.com>
Authored: Thu Feb 23 20:08:33 2017 -0500
Committer: reta <drreta@gmail.com>
Committed: Thu Feb 23 20:08:33 2017 -0500

----------------------------------------------------------------------
 .../tracing/htrace/ext/LoggingSpanReceiver.java | 53 ++++++++++++++++++++
 1 file changed, 53 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/9f54ff89/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/tracing/htrace/ext/LoggingSpanReceiver.java
----------------------------------------------------------------------
diff --git a/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/tracing/htrace/ext/LoggingSpanReceiver.java
b/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/tracing/htrace/ext/LoggingSpanReceiver.java
new file mode 100644
index 0000000..68845be
--- /dev/null
+++ b/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/tracing/htrace/ext/LoggingSpanReceiver.java
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.tracing.htrace.ext;
+
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.htrace.core.HTraceConfiguration;
+import org.apache.htrace.core.Span;
+import org.apache.htrace.core.SpanReceiver;
+
+public class LoggingSpanReceiver extends SpanReceiver {
+    public static final String LOG_LEVEL_KEY = "cxf.log.level";
+    public static final String LOG_LEVEL_ERROR = Level.SEVERE.getName();
+    public static final String LOG_LEVEL_DEBUG = Level.FINE.getName();
+    public static final String LOG_LEVEL_INFO = Level.INFO.getName();
+    public static final String LOG_LEVEL_WARN = Level.WARNING.getName();
+
+    private static final Logger LOG = LogUtils.getL7dLogger(LoggingSpanReceiver.class);
+    private final Level level;
+
+    public LoggingSpanReceiver(HTraceConfiguration conf) {
+        level = Level.parse(conf.get(LOG_LEVEL_KEY, LOG_LEVEL_DEBUG));
+    }
+
+    @Override
+    public void receiveSpan(Span span) {
+        LOG.log(level, span.toString());
+    }
+
+    @Override
+    public void close() throws IOException {
+    }
+}


Mime
View raw message