# Feature Request: Disable logging of SqlExceptionHelper for a single transaction

**URL:** <https://discourse.hibernate.org/t/feature-request-disable-logging-of-sqlexceptionhelper-for-a-single-transaction/7095>\
**Category:** Hibernate ORM\
**Created:** [January 4, 2023, 7:10am UTC](https://discourse.hibernate.org/t/feature-request-disable-logging-of-sqlexceptionhelper-for-a-single-transaction/7095 "2023-01-04T07:10:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Herr\_Derb](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/herr_derb/32/2191_2.png) [@Herr\_Derb](https://discourse.hibernate.org/u/Herr_Derb)\
**Post date:** [January 4, 2023, 7:10am UTC](https://discourse.hibernate.org/t/feature-request-disable-logging-of-sqlexceptionhelper-for-a-single-transaction/7095/1 "2023-01-04T07:10:47Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [January 4, 2023, 7:43pm UTC](https://discourse.hibernate.org/t/feature-request-disable-logging-of-sqlexceptionhelper-for-a-single-transaction/7095/2 "2023-01-04T19:43:04Z")

</div>

Hi there. If you have any concrete suggestions, then please join our [Zulip Chat](https://hibernate.zulipchat.com/#narrow/stream/132096-hibernate-user) 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.

---

<div class="post-metadata">

**Author:** ![David\_Kubecka](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/david_kubecka/32/2377_2.png) [@David\_Kubecka](https://discourse.hibernate.org/u/David_Kubecka)\
**Post date:** [April 11, 2023, 10:57am UTC](https://discourse.hibernate.org/t/feature-request-disable-logging-of-sqlexceptionhelper-for-a-single-transaction/7095/3 "2023-04-11T10:57:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Paul\_C](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/paul_c/32/2826_2.png) [@Paul\_C](https://discourse.hibernate.org/u/Paul_C)\
**Post date:** [November 25, 2023, 12:45am UTC](https://discourse.hibernate.org/t/feature-request-disable-logging-of-sqlexceptionhelper-for-a-single-transaction/7095/4 "2023-11-25T00:45:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [November 27, 2023, 6:01pm UTC](https://discourse.hibernate.org/t/feature-request-disable-logging-of-sqlexceptionhelper-for-a-single-transaction/7095/5 "2023-11-27T18:01:15Z")

</div>

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.
