How silent some log type?

We have WARN logs produced by Hibernate that are just noise for us.

Mainly:

  1. WARN Batch containing %s statements could not be sorted (might indicate a circular entity relationship)
    Because we have a few cases with a graph of entities. In reality the graph is a directed graph without any circularity, and I can’t understand why we get this log, but that’s another issue ( Jira ).
  2. ERROR o.h.e.j.s.SqlExceptionHelper: ERROR: deadlock detected\n Detail: Process 10486 waits for ShareLock on transaction 57845238; blocked by process 10509
    These concurrency errors can happen while processing async messages, and they are not an issue for us because we have a retry mechanism to handle them.

How can we silence these specific logs without muting all the warnings/errors?

In a typical logging setup, they would be emitted by different loggers, and we could configure Logback to silence just those specific loggers. But in Hibernate/JBoss logging, they are all produced by a few loggers such as o.h.e.j.s.SqlExceptionHelper or org.hibernate.orm.jdbc.error.

As of Hibernate ORM 7 we have a configuration option hibernate.jdbc.log.errors that you can set to false in the Hibernate ORM configuration to avoid logging JDBC errors.

But this is all or nothing.
Is it possible to only mute the warn HHH000247 ?

It’s an all or nothing, true, but the errors are thrown as exceptions usually anyway, so you would still see them being logged at a different level potentially.
Possible alternatives are to configure logging filters where you can just skip certain log messages. JBoss Logging is just a wrapper, like SLF4j, and there is an underlying logging implementation that implements the JBoss Logging interfaces. So you only need to figure out what logging implementation is in use in your environment and apply a logging filter that then skips this message.