BatchingBatch logging SQL values at an ERROR level

Description

BatchingBatch will log failed executions at an "ERROR" level with the SQL values included. This could compromise security or violate compliance by including secrets or personal information in the logs, but squelching all ERROR level logs for the class is not desirable.

An example:

Since this exception is logged and then a new exception re-thrown, it should be logged at a DEBUG level, and the handler of the exception should be tasked with log the exception. That also would allow the exception to avoid being logged twice or logging it as an ERROR in a non-fault use case, e.g. optimistic de-duplication of data.
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/BatchingBatch.java#L128-L129

At the very least, it should not be logged with the values at an ERROR level.

Environment

None

Status

Assignee

Unassigned

Reporter

Mike Reardon

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure