diff --git a/CHANGELOG.md b/CHANGELOG.md index eb1a306..84e7239 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +# 0.20.1 + +- JAX-RS Base Server Improvements: + - `FallbackExceptionMapper` explicitly logs the stack trace for otherwise unhandled exceptions to aid in diagnosis + of the underlying issue + # 0.20.0 - Build improvements: diff --git a/jaxrs-base-server/src/main/java/io/telicent/smart/cache/server/jaxrs/errors/FallbackExceptionMapper.java b/jaxrs-base-server/src/main/java/io/telicent/smart/cache/server/jaxrs/errors/FallbackExceptionMapper.java index aca8352..3d3f6ba 100644 --- a/jaxrs-base-server/src/main/java/io/telicent/smart/cache/server/jaxrs/errors/FallbackExceptionMapper.java +++ b/jaxrs-base-server/src/main/java/io/telicent/smart/cache/server/jaxrs/errors/FallbackExceptionMapper.java @@ -20,6 +20,8 @@ import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Maps otherwise unhandled errors into RFC 7807 Problem responses @@ -27,6 +29,8 @@ @Provider public class FallbackExceptionMapper implements ExceptionMapper { + private static final Logger LOGGER = LoggerFactory.getLogger(FallbackExceptionMapper.class); + private String buildDetail(Throwable e) { StringBuilder builder = new StringBuilder(); while (e != null) { @@ -55,6 +59,9 @@ public Response toResponse(Exception exception) { //@formatter:on } + // Explicitly log the error with its stack trace for diagnostic purposes + LOGGER.error("Unhandled exception, see stack trace for more detail:", exception); + // For any other error just translate into a 500 Internal Server Error //@formatter:off return new Problem("InternalServerError",