Skip to content

Commit

Permalink
add logging for error response header
Browse files Browse the repository at this point in the history
  • Loading branch information
anuvedverma committed Jul 1, 2024
1 parent 28bde1d commit 2773cf3
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,28 @@ protected void postConnectionHook(
+ " servlet path {} , toString {}", request.getRequestURL(),
request.getRequestURI(), request.getServletPath(), request.toString(), var9);
errorLogHeaders(request);
errorLogHeaders(response);
callback.failed(var9);
}
}

protected void errorLogHeaders(HttpServletRequest request) {
log.error("-------HttpServletRequest headers---------");
log.error("------- error HttpServletRequest headers---------");
Enumeration<String> headers = request.getHeaderNames();
while (headers.hasMoreElements()) {
String header = headers.nextElement();
log.error(header + "->" + request.getHeader(header));
}
}

protected void errorLogHeaders(HttpServletResponse response) {
log.error("------- error HttpServletResponse headers---------");
Collection<String> headers = response.getHeaderNames();
for (String header : headers) {
log.error(header + "->" + response.getHeader(header));
}
}

protected void debugLogHeaders(HttpServletRequest request) {
if (log.isDebugEnabled()) {
log.debug("-------HttpServletRequest headers---------");
Expand Down

0 comments on commit 2773cf3

Please sign in to comment.