Feature Request: Disable logging of SqlExceptionHelper for a single transaction

The SqlExceptionHelper is great to detect unexpected issues. Altought, It can pollute the logs with ERROR and WARN entries, even if the corresponding exceptions are expected and handled in code.

The current way to avoid this, is to completly switch of the logging of the SqlExceptionHelper, loosing any other unexpected error logs, in case of a bad exception handly.

It would be great, if one could disable the SqlExceptionHelper logging on a transaction basis, meaning one could switch of the logging for a specific transaction (e.g. by adding a new hibernate annotation next to @Transactional or even programatically inside of the transaction)

Hi there. If you have any concrete suggestions, then please join our Zulip Chat where you can bring up this idea.
I agree that logging an error that is just about to be thrown as exception anyway is not a good idea and we should try to get rid of this pattern. I’m pretty sure that others on the chat will agree when you bring this topic up.

1 Like

@Herr_Derb @beikov Did you by any chance create an issue which can be followed and upvoted?

1 Like

Hi all, I’m running to the same issue. I catch ConstraintViolationException but Hibernate still logs it as ERROR. It pollutes log monitoring.

If you are running into this issue and this is important to you, then please be so kind and provide a pull request that fixes this.