Request logging of user ID and thread name is broken
Author: accwebsCreated Sep 1, 2026Updated Sep 10, 2026
At present, with Logback Access's request logging implementation, Dropwizard request logs fail to log a few fields. After some extensive testing, the affected fields are:
- user ID
- thread name
Other bugs:
- 'response header' logging logs "" (empty) instead of - when the header is not present.
- (Where the 'request header' logging DOES log a dash.)
- request/response content logging - when enabled - does not honor character encodings
- the IAccessEvent.getRequest/getResponse's decision to return a fake HttpServletRequest/HttpServletResponse breaks esoteric features in logback-access like
AccessEventDiscriminator. This can't be wired up in Dropwizard today best I can tell, but it's sloppy.
The source of the user ID problem is again the RequestWrapper class in the logback-access-jetty12 library:
@Override
public String getRemoteUser() {
return null;
}
@Override
public boolean isUserInRole(String role) {
return false;
}
@Override
public Principal getUserPrincipal() {
return null;
}Separately, the lack of logging "thread name" come down to simply not calling AccessEvent.setThreadName() in the RequestLogImpl/LogbackAccessRequestLog log(...) implementation (neither implementation does this). Obviously this is not nearly as much of a concern as the lack of user logging.
Source: dropwizard/dropwizard