Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
3.5.10
-
None
-
any
Description
The mariadb JDBC driver will log warning messages when errors happen, and then throws an exception.
This is known as the log-then-throw antipattern.
In our case, we're handling those exceptions, and the logged warning is irritating for users (see https://github.com/keycloak/keycloak/issues/51920)
Suggested fix: When throws an exception, never log.
Problematic code: Whenever "new ErrorPacket(buf, context);" is called, it will log the error. This is not what we need/want when an exception is thrown directly after.
Possible fixes:
- Remove the warning
- Downgrade the log to DEBUG/TRACE
- Pass a parameter to the constructor when it should not be logged as a warning
Once we agree on the solution, I'm happy to contribute a PR.
Other places like PreparePacket.java:74, PrepareExecutePacket.java:158, StandardClient.java:342/510, and Result.java:220/282 are affected as well.