Skip to content

Commit

Permalink
feat(web): Include requestUserAgent and requestPort in request log (
Browse files Browse the repository at this point in the history
#843)

This will make it easier to track down particular client libraries
when multiple connectors are being used.
  • Loading branch information
ajordens committed Jul 2, 2019
1 parent a7952d7 commit 85341ee
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public void afterCompletion(
// 127.0.0.1 "GET /limecat.jpg HTTP/1.0" 200 2326
try {
MDC.put("requestDuration", getRequestDuration(request));
MDC.put("requestUserAgent", request.getHeader("User-Agent"));
MDC.put("requestPort", String.valueOf(request.getServerPort()));

log.debug(
"{} \"{} {} {}\" {} {}",
value("sourceIp", sourceIpAddress(request)),
Expand All @@ -54,6 +57,8 @@ public void afterCompletion(
value("responseSize", getResponseSize(response)));
} finally {
MDC.remove("requestDuration");
MDC.remove("requestUserAgent");
MDC.remove("requestPort");
}
}

Expand Down

0 comments on commit 85341ee

Please sign in to comment.