-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent error logging of thrown exceptions in quarkus-resteasy-reactive-jackson #31945
Comments
/cc @FroMage (resteasy-reactive), @Sgitario (resteasy-reactive), @evanchooly (kotlin), @geoand (jackson,kotlin,resteasy-reactive), @gsmet (jackson), @stuartwdouglas (resteasy-reactive) |
Thanks, I'll have a look |
The PR does a few things: * Adds debug logging for WebApplicationException instances * Eliminates duplicate logging of exceptions * Adds a hack to ensure that application provided IOException cases are logged properly Closes: quarkusio#31945
#31975 updated RESTEasy Reactive to be more consistent with logging exceptions. I do not consider RESTEasy Classic's behavior of logging |
I think that's fair. In our case, we would like to log Alternatively, would it be possible to control the log level of the new log statement? |
Do you mean through a configuration property? |
If possible, that would be great |
It's possible, but probably best looked at in light of a complete solution for configuring RESTEasy Reactive logging. Mind opening an issue for that? |
Sure. What about the inconsistent |
I am not sure that's actually the wrong behavior or not. Does that use case work in RESTEasy Classic? |
I see that RESTEasy Classic does invoke the exception mapper, but to be honest that seems weird to me, because it makes the |
Reading the spec, I see:
Now one could argue that this only applies to JAX-RS Resources, not filters, but I still think that what RESTEasy Reactive does makes more sense. |
Why does the |
When a |
So the only way to log such |
Correct |
Sanitize RESTEasy Reactive exception logging
Describe the bug
Exceptions thrown during REST requests with the
quarkus-resteasy-reactive-jackson
server are inconsistent.With
quarkus-resteasy-jackson
, the classic REST server, all types of exceptions were logged once.If I add a
ExceptionMapper<WebApplicationException>
or@ServerExceptionMapper
then I can make a mapper that logs theWebApplicationException
. However, this does not work if theWebApplicationException
was thrown from aContainerRequestFilter
with a response. Odly enough it works if you throw aWebApplicationException
without providing a response:Will not produce a log from the
ExceptionMapper<WebApplicationException>
, whereas:will.
Expected behavior
Same behaviour as with RestEasy Classic: Each type of exception is logged exactly once.
Actual behavior
Unchecked exceptions are logged twice
Checked exceptions are logged once
WebApplicationExceptions are not logged at all
Nothing to show here :)
How to Reproduce?
I've added a reproducer with examples here: https://github.com/AndreasPetersen/quarkus-resteasy-reactive-error-logging
It contains three REST endpoints, one for each case. In addition, there is a
ExceptionMapper
that you can activate by adding@Provider
on the class. Likewise, there is are someContainerRequestFilter
s throwing exceptions that can be activated by adding@Provider
as well.Output of
uname -a
orver
Microsoft Windows [Version 10.0.19044.2604]
Output of
java -version
openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment Temurin-17.0.2+8 (build 17.0.2+8)
OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.16.4
Build tool (ie. output of
mvnw --version
orgradlew --version
)Welcome to Gradle 8.0.2!
Here are the highlights of this release:
For more details see https://docs.gradle.org/8.0.2/release-notes.html
Gradle 8.0.2
Build time: 2023-03-03 16:41:37 UTC
Revision: 7d6581558e226a580d91d399f7dfb9e3095c2b1d
Kotlin: 1.8.10
Groovy: 3.0.13
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 11.0.17 (Eclipse Adoptium 11.0.17+8)
OS: Windows 10 10.0 amd64
Additional information
No response
The text was updated successfully, but these errors were encountered: