summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaša Živkov <sasa.zivkov@sap.com>2019-12-12 17:12:16 +0100
committerSaša Živkov <zivkov@gmail.com>2019-12-12 16:25:25 +0000
commit4e0a432f8e05e0b07b4af8a67a8fba21560f5b99 (patch)
treea0cd95a39582a33ce9ec8a29db0d3a9a066522fc
parentada0e04d66a2dafd0173e0cde25cfe608bf1a7a6 (diff)
Log also thread name in the httpd_log
Having thread name in the httpd_log makes it easier to match entries from the error_log and httpd_log (note that error_log entries already contain the thread name). With the thread name included in each log entry in the httpd_log we have more data to match an error to a request than just the timestamp. Even with the request trace feature [1] this is still useful as we can do more analysis before we ask the user to reproduce an error using the request trace. [1] https://gerrit-review.googlesource.com/Documentation/user-request-tracing.html Change-Id: I60f0fde1c2708bdc56e6ab458d66abee1b9c59aa
-rw-r--r--java/com/google/gerrit/pgm/http/jetty/HttpLog.java2
-rw-r--r--java/com/google/gerrit/pgm/http/jetty/HttpLogLayout.java5
2 files changed, 6 insertions, 1 deletions
diff --git a/java/com/google/gerrit/pgm/http/jetty/HttpLog.java b/java/com/google/gerrit/pgm/http/jetty/HttpLog.java
index b7ec2be684..a1d1d73ce6 100644
--- a/java/com/google/gerrit/pgm/http/jetty/HttpLog.java
+++ b/java/com/google/gerrit/pgm/http/jetty/HttpLog.java
@@ -72,7 +72,7 @@ class HttpLog extends AbstractLifeCycle implements RequestLog {
TimeUtil.nowMs(), // when
Level.INFO, // level
"", // message text
- "HTTPD", // thread name
+ Thread.currentThread().getName(), // thread name
null, // exception information
null, // current NDC string
null, // caller location
diff --git a/java/com/google/gerrit/pgm/http/jetty/HttpLogLayout.java b/java/com/google/gerrit/pgm/http/jetty/HttpLogLayout.java
index 2eea88d2fd..9f240ac7c9 100644
--- a/java/com/google/gerrit/pgm/http/jetty/HttpLogLayout.java
+++ b/java/com/google/gerrit/pgm/http/jetty/HttpLogLayout.java
@@ -41,6 +41,11 @@ public final class HttpLogLayout extends Layout {
opt(buf, event, HttpLog.P_HOST);
buf.append(' ');
+ buf.append('[');
+ buf.append(event.getThreadName());
+ buf.append(']');
+
+ buf.append(' ');
buf.append('-'); // identd on client system (never requested)
buf.append(' ');