commit
8a4dbf244d
|
@ -32,19 +32,22 @@ public class ClientErrorLoggingFilter extends GenericFilterBean {
|
||||||
Authentication auth = SecurityContextHolder.getContext()
|
Authentication auth = SecurityContextHolder.getContext()
|
||||||
.getAuthentication();
|
.getAuthentication();
|
||||||
|
|
||||||
if (auth != null) {
|
if (auth == null) {
|
||||||
int status = ((HttpServletResponse) response).getStatus();
|
chain.doFilter(request, response);
|
||||||
if (status >= 400 && status < 500) {
|
return;
|
||||||
if (errorCodes == null) {
|
}
|
||||||
logger.debug("User " + auth.getName() + " encountered error " + status);
|
int status = ((HttpServletResponse) response).getStatus();
|
||||||
} else {
|
if (status < 400 || status >= 500) {
|
||||||
if (errorCodes.stream()
|
chain.doFilter(request, response);
|
||||||
.filter(s -> s.value() == status)
|
return;
|
||||||
.findFirst()
|
}
|
||||||
.isPresent()) {
|
|
||||||
logger.debug("User " + auth.getName() + " encountered error " + status);
|
if (errorCodes == null) {
|
||||||
}
|
logger.debug("User " + auth.getName() + " encountered error " + status);
|
||||||
}
|
} else {
|
||||||
|
if (errorCodes.stream()
|
||||||
|
.anyMatch(s -> s.value() == status)) {
|
||||||
|
logger.debug("User " + auth.getName() + " encountered error " + status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,4 @@ server.port=8081
|
||||||
|
|
||||||
logging.level.root=INFO
|
logging.level.root=INFO
|
||||||
|
|
||||||
logging.level.com.baeldung.dsl.ClientErrorLoggingFilter=DEBUG
|
logging.level.com.baeldung.dsl.ClientErrorLoggingFilter=DEBUG
|
Loading…
Reference in New Issue