Avoid log-and-throw for Hibernate's SQL exceptions

Closes #49265

Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
This commit is contained in:
Alexander Schwartz 2026-05-26 22:08:34 +02:00 committed by GitHub
parent 4ac2dad432
commit 21ca050027
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 5 deletions

View file

@ -630,6 +630,10 @@ class KeycloakProcessor {
unitProperties.put(AvailableSettings.USE_SQL_COMMENTS, "true");
}
// SqlExceptionHelper should not log-and-throw error messages.
// As those messages might later be caught and handled, this is an antipattern so we prevent logging them.
unitProperties.put(JdbcSettings.LOG_JDBC_ERRORS, "false");
getOptionalKcValue(DatabaseOptions.DB_SQL_LOG_SLOW_QUERIES.getKey())
.ifPresent(v -> unitProperties.put(AvailableSettings.LOG_SLOW_QUERY, v));
}

View file

@ -31,11 +31,6 @@ quarkus.log.category."io.quarkus.arc.processor.IndexClassLookupUtils".level=off
quarkus.log.category."io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor".level=warn
quarkus.log.category."io.quarkus.deployment.steps.ReflectiveHierarchyStep".level=error
# SqlExceptionHelper will log-and-throw error messages.
# As those messages might later be caught and handled, this is an antipattern so we prevent logging them
# https://hibernate.zulipchat.com/#narrow/channel/132096-hibernate-user/topic/Feature.20Request.3A.20Disable.20logging.20of.20SqlExceptionHelper.20for
quarkus.log.category."org.hibernate.engine.jdbc.spi.SqlExceptionHelper".level=off
# Disable irrelevant EDB warning: EnterpriseDB does not store DATE columns. Instead, it auto-converts them to TIMESTAMPs. (edb_redwood_date=true)
quarkus.log.category."liquibase.database.core.PostgresDatabase".level=error