Environment: Hibernate 4.2.6
Scenario: error logs "ERROR" for specific "unique PK_XXX restriction violated" sql exception. However, due to our multi-instance deployment scenario, we need to set it to the "INFO" level for this particular "unique PK_XXX constraint" excluded by sql exception. (So this does not confuse IT professionals).
In other words, technically it's “ERROR”, but it's “INFO” from a business perspective.
Currently
2016.01.19 13.20.14,299 [ ERROR ][ ][ ][ ] org.hibernate.engine.jdbc.spi.SqlExceptionHelper - logExceptions() ORA-00001: unique constraint (PK_LOCKINFO) violated
Desired:
2016.01.19 13.20.14,299 [ INFO ][ ][ ][ ] org.hibernate.engine.jdbc.spi.SqlExceptionHelper - logExceptions() ORA-00001: unique constraint (PK_LOCKINFO) violated
What is the easiest way to move forward? Options I could think of:
- Change the inner hibernation class to "org.hibernate.engine.jdbc.spi.SqlExceptionHelper", then recompile the jar "hibernate"
Specific setting: in the case of a "unique PK_LOCKINFO restriction violated" by sql exception, register it as the "INFO" level instead of the "ERROR" level. But any other sql exceptions should still be logged as "ERROR". This option is challenging as you move forward. We will have to do this each time a sleeping update.
there is a class for extending and configuring the hibernate class "org.hibernate.engine.jdbc.spi.SqlExceptionHelper" in our own code base Thus, we do not need to collect a "sleeping" jar. Is it possible?
, "", -
, №3 . , .
?