Cédric BOONE (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=70121%3...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZjgwNGNlY2My...
) / Improvement (
https://hibernate.atlassian.net/browse/HHH-16748?atlOrigin=eyJpIjoiZjgwNG...
) HHH-16748 (
https://hibernate.atlassian.net/browse/HHH-16748?atlOrigin=eyJpIjoiZjgwNG...
) JdbcBindingLogging - don't use logging trace activation in a interface field (
https://hibernate.atlassian.net/browse/HHH-16748?atlOrigin=eyJpIjoiZjgwNG...
)
Issue Type: Improvement Affects Versions: 6.1.7, 6.2.4 Assignee: Unassigned Components:
hibernate-core Created: 05/Jun/2023 04:18 AM Labels: logging Priority: Minor Reporter:
Cédric BOONE (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=70121%3...
)
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.TRACE_ENABLED ) {
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.
(
https://hibernate.atlassian.net/browse/HHH-16748#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16748#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:4a1ccf9 )