You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:24:31 UTC
[sling-org-apache-sling-tracer] annotated tag
org.apache.sling.tracer-1.0.2 created (now c83ab55)
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a change to annotated tag org.apache.sling.tracer-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-tracer.git.
at c83ab55 (tag)
tagging d163bc2cf3e4a67869513f04ea2f8efc872cdb4d (commit)
by Chetan Mehrotra
on Thu Oct 20 09:41:16 2016 +0000
- Log -----------------------------------------------------------------
org.apache.sling.tracer-1.0.2
-----------------------------------------------------------------------
This annotated tag includes the following new commits:
new 8e6b5d0 SLING-4739 - Log Tracer - To enable logs for specific category at specific level and only for specific request
new 61822f4 SLING-4739 - Log Tracer - To enable logs for specific category at specific level and only for specific request
new 6df4236 SLING-4739 - Log Tracer - To enable logs for specific category at specific level and only for specific request
new 5532990 SLING-4739 - Log Tracer - To enable logs for specific category at specific level and only for specific request
new f3c7f75 [maven-release-plugin] prepare release org.apache.sling.tracer-0.0.2
new 2476c10 [maven-release-plugin] prepare for next development iteration
new a1ede00 Contrib: remove superflous sling.java.version=6 as it's the default now
new c0fa143 Add contrib/extensions/tracer to module list and bump the sling-parent version in tracer to latest
new 83ba09f SLING-5459 - Recording of tracer logs
new eb0d0c0 SLING-5459 - Recording of tracer logs
new e284239 SLING-5459 - Recording of tracer logs
new 0f4f997 SLING-5459 - Recording of tracer logs
new c5e3f32 SLING-5459 - Recording of tracer logs
new de2f6e5 SLING-5459 - Recording of tracer logs
new 9a4867d SLING-5459 - Recording of tracer logs
new 80bc148 SLING-5459 - Recording of tracer logs
new 6a25a1d SLING-5459 - Recording of tracer logs
new bdc2fb6 SLING-5459 - Recording of tracer logs
new 338f7fb SLING-5459 - Recording of tracer logs
new 0f98bb6 SLING-5504 - Reduce memory footprint of stored recording data
new 9d3d4dc SLING-5504 - Reduce memory footprint of stored recording data
new 3ded49e SLING-5504 - Reduce memory footprint of stored recording data
new d4dc992 SLING-5504 - Reduce memory footprint of stored recording data
new 96a80a7 SLING-5459 - Recording of tracer logs
new 1a9ba7e SLING-5504 - Reduce memory footprint of stored recording data
new 7c657ac SLING-5505 - Allow recording of caller stacktrace with the logs
new cdfbb9d SLING-5507 - Collect more details around query execution
new 393c666 SLING-5507 - Collect more details around query execution
new b62cf45 SLING-5507 - Collect more details around query execution
new 02f853e SLING-5505 - Allow recording of caller stacktrace with the logs
new 7065d83 SLING-5505 - Allow recording of caller stacktrace with the logs
new c6dad28 SLING-5459 - Recording of tracer logs
new 88f3d3a SLING-5507 - Collect more details around query execution
new 15a3ae3 [maven-release-plugin] prepare release org.apache.sling.tracer-1.0.0
new 41d7cef [maven-release-plugin] prepare for next development iteration
new ac1dc28 SLING-6089 - Log Tracer does not work with system having new HTTP whiteboard implementation
new 6813db4 SLING-6089 - Log Tracer does not work with system having new HTTP whiteboard implementation
new 57859e8 SLING-6089 - Log Tracer does not work with system having new HTTP whiteboard implementation
new 8059adb SLING-5762 - Relax Sling Log Tracer package imports
new 871b6f3 SLING-6118 - Handle empty tracer config header gracefully
new 7e4445d SLING-6119 - Log parameters not captured correctly in few cases
new 0406840 SLING-6120 - Collect logger names which get hit for a given request thread
new 6a89460 [maven-release-plugin] prepare release org.apache.sling.tracer-1.0.2
new d163bc2 [maven-release-plugin] copy for tag org.apache.sling.tracer-1.0.2
The 44 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
--
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].
[sling-org-apache-sling-tracer] 05/10: SLING-5762 - Relax Sling Log
Tracer package imports
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.tracer-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-tracer.git
commit 8059adbc076884e68c2a2ebd0e09824ee80ba6ce
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Sat Oct 8 09:29:40 2016 +0000
SLING-5762 - Relax Sling Log Tracer package imports
Reduce the version to allow using tracer on setups which have older version of commons osgi
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tracer@1763880 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 8291063..06c3c32 100644
--- a/pom.xml
+++ b/pom.xml
@@ -129,7 +129,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.commons.json</artifactId>
- <version>2.0.8</version>
+ <version>2.0.6</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-tracer] 10/10: [maven-release-plugin] copy
for tag org.apache.sling.tracer-1.0.2
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.tracer-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-tracer.git
commit d163bc2cf3e4a67869513f04ea2f8efc872cdb4d
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Thu Oct 20 09:41:16 2016 +0000
[maven-release-plugin] copy for tag org.apache.sling.tracer-1.0.2
git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.tracer-1.0.2@1765787 13f79535-47bb-0310-9956-ffa450edef68
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-tracer] 04/10: SLING-6089 - Log Tracer does
not work with system having new HTTP whiteboard implementation
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.tracer-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-tracer.git
commit 57859e81779dc81fd600faa93e26b53668f47d3b
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Mon Oct 3 11:41:42 2016 +0000
SLING-6089 - Log Tracer does not work with system having new HTTP whiteboard implementation
Replace filter.scope with sling.filter.scope
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tracer@1763156 13f79535-47bb-0310-9956-ffa450edef68
---
src/main/java/org/apache/sling/tracer/internal/LogTracer.java | 2 +-
src/test/java/org/apache/sling/tracer/internal/LogTracerTest.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/sling/tracer/internal/LogTracer.java b/src/main/java/org/apache/sling/tracer/internal/LogTracer.java
index 714f02b..59c647c 100644
--- a/src/main/java/org/apache/sling/tracer/internal/LogTracer.java
+++ b/src/main/java/org/apache/sling/tracer/internal/LogTracer.java
@@ -265,7 +265,7 @@ public class LogTracer {
private void registerFilters(BundleContext context) {
Dictionary<String, Object> slingFilterProps = new Hashtable<String, Object>();
- slingFilterProps.put("filter.scope", "REQUEST");
+ slingFilterProps.put("sling.filter.scope", "REQUEST");
slingFilterProps.put(Constants.SERVICE_DESCRIPTION, "Sling Filter required for Log Tracer");
slingFilterRegistration = context.registerService(Filter.class.getName(),
new SlingTracerFilter(), slingFilterProps);
diff --git a/src/test/java/org/apache/sling/tracer/internal/LogTracerTest.java b/src/test/java/org/apache/sling/tracer/internal/LogTracerTest.java
index ec4a867..da7b200 100644
--- a/src/test/java/org/apache/sling/tracer/internal/LogTracerTest.java
+++ b/src/test/java/org/apache/sling/tracer/internal/LogTracerTest.java
@@ -382,7 +382,7 @@ public class LogTracerTest {
context.bundleContext().getServiceReferences(Filter.class, null);
ServiceReference<Filter> result = null;
for (ServiceReference<Filter> ref : refs) {
- if (slingFilter && ref.getProperty("filter.scope") != null) {
+ if (slingFilter && ref.getProperty("sling.filter.scope") != null) {
result = ref;
break;
} else if (!slingFilter && ref.getProperty("pattern") != null) {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-tracer] 07/10: SLING-6119 - Log parameters
not captured correctly in few cases
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.tracer-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-tracer.git
commit 7e4445dac1ed303161c443f714640f286d698a43
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Sat Oct 8 10:07:21 2016 +0000
SLING-6119 - Log parameters not captured correctly in few cases
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tracer@1763884 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/sling/tracer/internal/JSONRecording.java | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/sling/tracer/internal/JSONRecording.java b/src/main/java/org/apache/sling/tracer/internal/JSONRecording.java
index 2941caf..1a7b654 100644
--- a/src/main/java/org/apache/sling/tracer/internal/JSONRecording.java
+++ b/src/main/java/org/apache/sling/tracer/internal/JSONRecording.java
@@ -241,6 +241,7 @@ class JSONRecording implements Recording, Comparable<JSONRecording> {
final Level level;
final String logger;
final FormattingTuple tuple;
+ final String[] params;
final long timestamp = System.currentTimeMillis();
final List<StackTraceElement> caller;
@@ -248,6 +249,7 @@ class JSONRecording implements Recording, Comparable<JSONRecording> {
this.level = level != null ? level : Level.INFO;
this.logger = logger;
this.tuple = tuple;
+ this.params = getParams(tuple);
this.caller = getCallerData(tc);
}
@@ -258,6 +260,20 @@ class JSONRecording implements Recording, Comparable<JSONRecording> {
return Collections.emptyList();
}
+ private static String[] getParams(FormattingTuple tuple) {
+ //Eagerly convert arg to string so that if arg is bound by context like
+ //session then it gets evaluated when that is valid i.e. at time of call itself
+ Object[] params = tuple.getArgArray();
+ String[] strParams = null;
+ if (params != null){
+ strParams = new String[params.length];
+ for (int i = 0; i < params.length; i++) {
+ strParams[i] = toString(params[i]);
+ }
+ }
+ return strParams;
+ }
+
private static String toString(Object o) {
//Make use of Slf4j null safe toString support!
return MessageFormatter.format("{}", o).getMessage();
@@ -276,12 +292,11 @@ class JSONRecording implements Recording, Comparable<JSONRecording> {
jw.key("logger").value(logger);
jw.key("message").value(tuple.getMessage());
- Object[] params = tuple.getArgArray();
if (params != null) {
jw.key("params");
jw.array();
- for (Object o : params) {
- jw.value(toString(o));
+ for (String o : params) {
+ jw.value(o);
}
jw.endArray();
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-tracer] 06/10: SLING-6118 - Handle empty
tracer config header gracefully
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.tracer-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-tracer.git
commit 871b6f39088a734b99168795f8295ac5dec3ac01
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Sat Oct 8 09:29:53 2016 +0000
SLING-6118 - Handle empty tracer config header gracefully
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tracer@1763881 13f79535-47bb-0310-9956-ffa450edef68
---
.../sling/tracer/internal/JSONRecording.java | 16 +------
.../apache/sling/tracer/internal/LogTracer.java | 5 +++
.../org/apache/sling/tracer/internal/Util.java | 47 +++++++++++++++++++++
.../org/apache/sling/tracer/internal/UtilTest.java | 49 ++++++++++++++++++++++
4 files changed, 103 insertions(+), 14 deletions(-)
diff --git a/src/main/java/org/apache/sling/tracer/internal/JSONRecording.java b/src/main/java/org/apache/sling/tracer/internal/JSONRecording.java
index 21d99d4..2941caf 100644
--- a/src/main/java/org/apache/sling/tracer/internal/JSONRecording.java
+++ b/src/main/java/org/apache/sling/tracer/internal/JSONRecording.java
@@ -53,6 +53,8 @@ import org.slf4j.helpers.FormattingTuple;
import org.slf4j.helpers.MessageFormatter;
import static com.google.common.base.Preconditions.checkArgument;
+import static org.apache.sling.tracer.internal.Util.nullSafeString;
+import static org.apache.sling.tracer.internal.Util.nullSafeTrim;
class JSONRecording implements Recording, Comparable<JSONRecording> {
private static final String[] QUERY_API_PKGS = {
@@ -389,18 +391,4 @@ class JSONRecording implements Recording, Comparable<JSONRecording> {
}
}
- private static String nullSafeTrim(String s){
- if(s == null){
- return "";
- }
- return s.trim();
- }
-
- private static String nullSafeString(Object o){
- if (o != null){
- return o.toString();
- }
- return null;
- }
-
}
diff --git a/src/main/java/org/apache/sling/tracer/internal/LogTracer.java b/src/main/java/org/apache/sling/tracer/internal/LogTracer.java
index 59c647c..c95d7fd 100644
--- a/src/main/java/org/apache/sling/tracer/internal/LogTracer.java
+++ b/src/main/java/org/apache/sling/tracer/internal/LogTracer.java
@@ -58,6 +58,8 @@ import org.osgi.service.http.whiteboard.HttpWhiteboardConstants;
import org.slf4j.LoggerFactory;
import org.slf4j.Marker;
+import static org.apache.sling.tracer.internal.Util.trimToNull;
+
/**
* Tracer provides support for enabling the logs for specific category at specific level and
* only for specific request. It provides a very fine level of control via config provided
@@ -224,6 +226,9 @@ public class LogTracer {
TracerContext getTracerContext(String tracerSetNames, String tracerConfig, Recording recording) {
//No config or tracer set name provided. So tracing not required
+ tracerConfig = trimToNull(tracerConfig);
+ tracerSetNames = trimToNull(tracerSetNames);
+
if (tracerSetNames == null && tracerConfig == null) {
return null;
}
diff --git a/src/main/java/org/apache/sling/tracer/internal/Util.java b/src/main/java/org/apache/sling/tracer/internal/Util.java
new file mode 100644
index 0000000..617881e
--- /dev/null
+++ b/src/main/java/org/apache/sling/tracer/internal/Util.java
@@ -0,0 +1,47 @@
+/*
+ * 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.sling.tracer.internal;
+
+class Util {
+ static String trimToNull(String s) {
+ if (s == null) {
+ return null;
+ }
+ s = s.trim();
+ if (s.isEmpty()) {
+ return null;
+ }
+ return s;
+ }
+
+ static String nullSafeString(Object o){
+ if (o != null){
+ return o.toString();
+ }
+ return null;
+ }
+
+ static String nullSafeTrim(String s){
+ if(s == null){
+ return "";
+ }
+ return s.trim();
+ }
+}
diff --git a/src/test/java/org/apache/sling/tracer/internal/UtilTest.java b/src/test/java/org/apache/sling/tracer/internal/UtilTest.java
new file mode 100644
index 0000000..8dd878e
--- /dev/null
+++ b/src/test/java/org/apache/sling/tracer/internal/UtilTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.sling.tracer.internal;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class UtilTest {
+
+ @Test
+ public void trimToNull() throws Exception{
+ assertEquals(null, Util.trimToNull(null));
+ assertEquals(null, Util.trimToNull(""));
+ assertEquals("foo", Util.trimToNull("foo"));
+ assertEquals("foo", Util.trimToNull(" foo"));
+ }
+
+ @Test
+ public void nullSafeString() throws Exception{
+ assertEquals(null, Util.nullSafeString(null));
+ assertEquals("foo", Util.nullSafeString("foo"));
+ assertEquals("1", Util.nullSafeString(1));
+ }
+
+ @Test
+ public void nullSafeTrim() throws Exception{
+ assertEquals("", Util.nullSafeTrim(null));
+ assertEquals("foo", Util.nullSafeTrim(" foo"));
+ }
+
+}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-tracer] 01/10: [maven-release-plugin]
prepare for next development iteration
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.tracer-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-tracer.git
commit 41d7cefef0e3ee8874b48a5d9b93062aba50ecbb
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Tue Apr 19 10:07:27 2016 +0000
[maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tracer@1739888 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 55a3821..8c68597 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
<artifactId>org.apache.sling.tracer</artifactId>
<packaging>bundle</packaging>
- <version>1.0.0</version>
+ <version>1.0.1-SNAPSHOT</version>
<name>Apache Sling Log Tracer</name>
<description>
@@ -42,9 +42,9 @@
</description>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.tracer-1.0.0</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.tracer-1.0.0</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.tracer-1.0.0</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tracer</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tracer</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/tracer</url>
</scm>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-tracer] 09/10: [maven-release-plugin]
prepare release org.apache.sling.tracer-1.0.2
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.tracer-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-tracer.git
commit 6a894601489aa38666a11c10c3f54251d6b051e4
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Thu Oct 20 09:41:02 2016 +0000
[maven-release-plugin] prepare release org.apache.sling.tracer-1.0.2
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tracer@1765786 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 06c3c32..2f7bb48 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
<artifactId>org.apache.sling.tracer</artifactId>
<packaging>bundle</packaging>
- <version>1.0.1-SNAPSHOT</version>
+ <version>1.0.2</version>
<name>Apache Sling Log Tracer</name>
<description>
@@ -42,9 +42,9 @@
</description>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tracer</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tracer</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/tracer</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.tracer-1.0.2</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.tracer-1.0.2</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.tracer-1.0.2</url>
</scm>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-tracer] 08/10: SLING-6120 - Collect logger
names which get hit for a given request thread
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.tracer-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-tracer.git
commit 0406840151babe782a5a004f183fe04f7feec630
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Sat Oct 8 10:22:02 2016 +0000
SLING-6120 - Collect logger names which get hit for a given request thread
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tracer@1763885 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/sling/tracer/internal/JSONRecording.java | 20 ++++++++++++++++++++
.../org/apache/sling/tracer/internal/LogTracer.java | 2 ++
.../org/apache/sling/tracer/internal/Recording.java | 7 +++++++
.../apache/sling/tracer/internal/TracerContext.java | 4 ++++
4 files changed, 33 insertions(+)
diff --git a/src/main/java/org/apache/sling/tracer/internal/JSONRecording.java b/src/main/java/org/apache/sling/tracer/internal/JSONRecording.java
index 1a7b654..56c1804 100644
--- a/src/main/java/org/apache/sling/tracer/internal/JSONRecording.java
+++ b/src/main/java/org/apache/sling/tracer/internal/JSONRecording.java
@@ -33,8 +33,10 @@ import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Set;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
@@ -70,6 +72,7 @@ class JSONRecording implements Recording, Comparable<JSONRecording> {
private final boolean compress;
private final List<QueryEntry> queries = new ArrayList<QueryEntry>();
private final List<LogEntry> logs = new ArrayList<LogEntry>();
+ private final Set<String> loggerNames = new HashSet<String>();
private RequestProgressTracker tracker;
private byte[] json;
private final long start = System.currentTimeMillis();
@@ -139,6 +142,11 @@ class JSONRecording implements Recording, Comparable<JSONRecording> {
this.tracker = tracker;
}
+ @Override
+ public void recordCategory(String loggerName) {
+ loggerNames.add(loggerName);
+ }
+
public void done() {
try {
if (json == null) {
@@ -181,12 +189,24 @@ class JSONRecording implements Recording, Comparable<JSONRecording> {
addJson(jw, "queries", queries);
addJson(jw, "logs", logs);
+ addLoggerNames(jw);
jw.endObject();
osw.flush();
os.close();
return baos.toByteArray();
}
+ private void addLoggerNames(JSONWriter jw) throws JSONException {
+ List<String> sortedNames = new ArrayList<String>(loggerNames);
+ Collections.sort(sortedNames);
+ jw.key("loggerNames");
+ jw.array();
+ for (String o : sortedNames) {
+ jw.value(o);
+ }
+ jw.endArray();
+ }
+
private void addRequestProgressLogs(JSONWriter jw) throws JSONException {
if (tracker != null) {
jw.key("requestProgressLogs");
diff --git a/src/main/java/org/apache/sling/tracer/internal/LogTracer.java b/src/main/java/org/apache/sling/tracer/internal/LogTracer.java
index c95d7fd..9f38a65 100644
--- a/src/main/java/org/apache/sling/tracer/internal/LogTracer.java
+++ b/src/main/java/org/apache/sling/tracer/internal/LogTracer.java
@@ -431,6 +431,8 @@ public class LogTracer {
return FilterReply.NEUTRAL;
}
+ tracer.recordCategory(logger.getName());
+
TracerConfig tc = tracer.findMatchingConfig(logger.getName(), level);
if (tc != null) {
if (format == null) {
diff --git a/src/main/java/org/apache/sling/tracer/internal/Recording.java b/src/main/java/org/apache/sling/tracer/internal/Recording.java
index e7300c5..604652a 100644
--- a/src/main/java/org/apache/sling/tracer/internal/Recording.java
+++ b/src/main/java/org/apache/sling/tracer/internal/Recording.java
@@ -34,6 +34,11 @@ interface Recording {
public void registerTracker(RequestProgressTracker tracker) {
}
+
+ @Override
+ public void recordCategory(String loggerName) {
+
+ }
};
void log(TracerConfig tc, Level level, String logger, FormattingTuple tuple);
@@ -44,4 +49,6 @@ interface Recording {
* @param tracker from current request
*/
void registerTracker(RequestProgressTracker tracker);
+
+ void recordCategory(String loggerName);
}
diff --git a/src/main/java/org/apache/sling/tracer/internal/TracerContext.java b/src/main/java/org/apache/sling/tracer/internal/TracerContext.java
index 5859bce..0474662 100644
--- a/src/main/java/org/apache/sling/tracer/internal/TracerContext.java
+++ b/src/main/java/org/apache/sling/tracer/internal/TracerContext.java
@@ -103,6 +103,10 @@ class TracerContext {
return tuple != null;
}
+ public void recordCategory(String loggerName) {
+ recording.recordCategory(loggerName);
+ }
+
public void done() {
if (queryCount > 0) {
progressTracker.log("JCR Query Count {0}", queryCount);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-tracer] 02/10: SLING-6089 - Log Tracer does
not work with system having new HTTP whiteboard implementation
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.tracer-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-tracer.git
commit ac1dc28abf2a843b6c1e203c5d3cef82a9c92bb9
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Mon Oct 3 10:59:38 2016 +0000
SLING-6089 - Log Tracer does not work with system having new HTTP whiteboard implementation
Register the filter with both old and new properties
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tracer@1763153 13f79535-47bb-0310-9956-ffa450edef68
---
.../java/org/apache/sling/tracer/internal/LogTracer.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/sling/tracer/internal/LogTracer.java b/src/main/java/org/apache/sling/tracer/internal/LogTracer.java
index ea531ba..c9ec0e6 100644
--- a/src/main/java/org/apache/sling/tracer/internal/LogTracer.java
+++ b/src/main/java/org/apache/sling/tracer/internal/LogTracer.java
@@ -111,8 +111,9 @@ public class LogTracer {
private static final String PROP_TRACER_ENABLED = "enabled";
private static final boolean PROP_TRACER_SERVLET_ENABLED_DEFAULT = false;
- @Property(label = "Servlet Enabled",
- description = "Enable the Tracer Servlet",
+ @Property(label = "Recording Servlet Enabled",
+ description = "Enable the Tracer Servlet. This servlet is required for the tracer recording feature " +
+ "to work and provides access to the json dump of the recording performed",
boolValue = PROP_TRACER_SERVLET_ENABLED_DEFAULT
)
private static final String PROP_TRACER_SERVLET_ENABLED = "servletEnabled";
@@ -270,6 +271,15 @@ public class LogTracer {
Dictionary<String, Object> filterProps = new Hashtable<String, Object>();
filterProps.put("pattern", "/.*");
+
+ //Do not use constant name to keep dependency as optional
+ //filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/");
+ //filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT,
+ // "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=*)");
+
+ filterProps.put("osgi.http.whiteboard.filter.pattern", "/");
+ filterProps.put("osgi.http.whiteboard.context.select",
+ "(osgi.http.whiteboard.context.name=*)");
filterProps.put(Constants.SERVICE_DESCRIPTION, "Servlet Filter required for Log Tracer");
filterRegistration = context.registerService(Filter.class.getName(),
new TracerFilter(), filterProps);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-tracer] 03/10: SLING-6089 - Log Tracer does
not work with system having new HTTP whiteboard implementation
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.tracer-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-tracer.git
commit 6813db4aad12dda6057b899c16d18288b49e90cc
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Mon Oct 3 11:41:30 2016 +0000
SLING-6089 - Log Tracer does not work with system having new HTTP whiteboard implementation
As mentioned by Robert using constant does not lead to adding package dependency on the constant class package
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tracer@1763155 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 7 ++++++-
src/main/java/org/apache/sling/tracer/internal/LogTracer.java | 11 ++++-------
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/pom.xml b/pom.xml
index 8c68597..8291063 100644
--- a/pom.xml
+++ b/pom.xml
@@ -137,7 +137,12 @@
<version>3.0.0</version>
<scope>provided</scope>
</dependency>
-
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.http.whiteboard</artifactId>
+ <version>1.0.0</version>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
diff --git a/src/main/java/org/apache/sling/tracer/internal/LogTracer.java b/src/main/java/org/apache/sling/tracer/internal/LogTracer.java
index c9ec0e6..714f02b 100644
--- a/src/main/java/org/apache/sling/tracer/internal/LogTracer.java
+++ b/src/main/java/org/apache/sling/tracer/internal/LogTracer.java
@@ -54,6 +54,7 @@ import org.apache.sling.commons.osgi.PropertiesUtil;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.http.whiteboard.HttpWhiteboardConstants;
import org.slf4j.LoggerFactory;
import org.slf4j.Marker;
@@ -272,14 +273,10 @@ public class LogTracer {
Dictionary<String, Object> filterProps = new Hashtable<String, Object>();
filterProps.put("pattern", "/.*");
- //Do not use constant name to keep dependency as optional
- //filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/");
- //filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT,
- // "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=*)");
+ filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN, "/");
+ filterProps.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT,
+ "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=*)");
- filterProps.put("osgi.http.whiteboard.filter.pattern", "/");
- filterProps.put("osgi.http.whiteboard.context.select",
- "(osgi.http.whiteboard.context.name=*)");
filterProps.put(Constants.SERVICE_DESCRIPTION, "Servlet Filter required for Log Tracer");
filterRegistration = context.registerService(Filter.class.getName(),
new TracerFilter(), filterProps);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.