jaxrs: re-implement exceptions logging
This used to be in LoggingResponse.
@@ -112,18 +112,21 @@ public abstract class ExceptionMapperBase {
protected Response buildConflictingRequestResponse(final Exception e, final UriInfo uriInfo) {
final Response.ResponseBuilder responseBuilder = Response.status(Status.CONFLICT);
serializeException(e, uriInfo, responseBuilder);
+ log.warn("Conflicting request", e);
return responseBuilder.build();
}
protected Response buildNotFoundResponse(final Exception e, final UriInfo uriInfo) {
final Response.ResponseBuilder responseBuilder = Response.status(Status.NOT_FOUND);
serializeException(e, uriInfo, responseBuilder);
+ log.debug("Not found", e);
return responseBuilder.build();
}
protected Response buildBadRequestResponse(final Exception e, final UriInfo uriInfo) {
final Response.ResponseBuilder responseBuilder = Response.status(Status.BAD_REQUEST);
serializeException(e, uriInfo, responseBuilder);
+ log.warn("Bad request", e);
return responseBuilder.build();
}
@@ -131,12 +134,14 @@ public abstract class ExceptionMapperBase {
// TODO Forbidden?
final Response.ResponseBuilder responseBuilder = Response.status(Status.UNAUTHORIZED);
serializeException(e, uriInfo, responseBuilder);
+ log.debug("Unauthorized", e);
return responseBuilder.build();
}
protected Response buildInternalErrorResponse(final Exception e, final UriInfo uriInfo) {
final Response.ResponseBuilder responseBuilder = Response.status(Status.INTERNAL_SERVER_ERROR);
serializeException(e, uriInfo, responseBuilder);
+ log.warn("Internal error", e);
return responseBuilder.build();
}
@@ -144,6 +149,7 @@ public abstract class ExceptionMapperBase {
// 504 - Gateway Timeout
final Response.ResponseBuilder responseBuilder = Response.status(504);
serializeException(e, uriInfo, responseBuilder);
+ log.debug("Plugin Timeout", e);
return responseBuilder.build();
}
