Hello, The interface org.hibernate.type.descriptor.JdbcBindingLogging, that is responsible for logging org.hibernate.type.descriptor.jdbc.BasicBinder (an others) query value binding, has the following problem: It declares a field 'TRACE_ENABLED' (and 'DEBUG_ENABLED'). These are used to enable logging of BasicBinder. These field are evaluated only once, so you cannot change logging level at runtime.
boolean TRACE_ENABLED = LOGGER.isTraceEnabled();
boolean DEBUG_ENABLED = LOGGER.isDebugEnabled();
I don't know if it is the expected behavior, but in my case, I needed to see the binding value of a query in a wildfly environnement. I had to restart the wildfly for the trace logging configuration to be set correctly. In previous version (hibernate 5), the problem was not there. I think these fields could be deleted and we could use the logger method call at runtime, JdbcBindingLogging.LOGGER.isTraceEnabled() instead of JdbcBindingLogging.TRACE_ENABLED. For example in BasicBinder:
[...]
if ( JdbcBindingLogging.LOGGER.isTraceEnabled() ) {
JdbcBindingLogging.logBinding(
index,
jdbcType.getDefaultSqlTypeCode(),
getJavaType().extractLoggableRepresentation( value )
);
}
[...]
I'm not used to create ticket, I'm sorry if it is incomplete. Regards. |