diff --git a/docs/src/main/asciidoc/resteasy-reactive.adoc b/docs/src/main/asciidoc/resteasy-reactive.adoc index 2afd51743055b..c72cf886da222 100644 --- a/docs/src/main/asciidoc/resteasy-reactive.adoc +++ b/docs/src/main/asciidoc/resteasy-reactive.adoc @@ -1975,6 +1975,16 @@ public class Endpoint { } ---- +[NOTE] +==== +You can change the log level of the thrown `WebApplicationException` exceptions by configuring the following property `quarkus.log.category."WebApplicationException".level` like so: + +[source, properties] +---- +quarkus.log.category."WebApplicationException".level=DEBUG +---- +==== + If your endpoint method is delegating calls to another service layer which does not know of Jakarta REST, you need a way to turn service exceptions to an HTTP response, and you can do that using the diff --git a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java index 7b57c785c0b94..705e9e3075605 100644 --- a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java +++ b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java @@ -11,6 +11,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; +import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.container.CompletionCallback; import jakarta.ws.rs.container.ConnectionCallback; @@ -22,6 +23,7 @@ public abstract class AbstractResteasyReactiveContext, H extends RestHandler> implements Runnable, Closeable, ResteasyReactiveCallbackContext { protected static final Logger log = Logger.getLogger(AbstractResteasyReactiveContext.class); + protected static final Logger logWebApplicationExceptions = Logger.getLogger(WebApplicationException.class.getSimpleName()); protected H[] handlers; protected H[] abortHandlerChain; protected int position; @@ -322,7 +324,11 @@ public void handleException(Throwable t, boolean keepSameTarget) { handleUnrecoverableError(unwrapException(t)); } else { this.throwable = unwrapException(t); - log.debug("Restarting handler chain for exception exception", this.throwable); + if (t instanceof WebApplicationException) { + logWebApplicationExceptions.debug("Restarting handler chain for exception exception", this.throwable); + } else { + log.debug("Restarting handler chain for exception exception", this.throwable); + } abortHandlerChainStarted = true; restart(abortHandlerChain, keepSameTarget); } diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/RuntimeExceptionMapper.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/RuntimeExceptionMapper.java index ac90a5facd2b2..444158beb2a63 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/RuntimeExceptionMapper.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/RuntimeExceptionMapper.java @@ -31,6 +31,7 @@ public class RuntimeExceptionMapper { private static final Logger log = Logger.getLogger(RuntimeExceptionMapper.class); + private static final Logger logWebApplicationExceptions = Logger.getLogger(WebApplicationException.class.getSimpleName()); private static Map, ResourceExceptionMapper> mappers; @@ -102,7 +103,7 @@ public void mapException(Throwable throwable, ResteasyReactiveRequestContext con if ((IGNORE_RESPONSE == response)) { if (isWebApplicationException) { context.setResult(((WebApplicationException) throwable).getResponse()); - log.debug("Application failed the request", throwable); + logWebApplicationExceptions.debug("Application failed the request", throwable); } else { logBlockingErrorIfRequired(throwable, context); logNonBlockingErrorIfRequired(throwable, context); @@ -117,7 +118,7 @@ public void mapException(Throwable throwable, ResteasyReactiveRequestContext con } if (isWebApplicationException) { context.setResult(response); - log.debug("Application failed the request", throwable); + logWebApplicationExceptions.debug("Application failed the request", throwable); return; } if (throwable instanceof IOException) {