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
diff --git a/java/com/google/gerrit/pgm/http/jetty/HttpLog.java b/java/com/google/gerrit/pgm/http/jetty/HttpLog.java
index b7ec2be..a1d1d73 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 @@
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 2eea88d..9f240ac 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 @@
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(' ');