HHH-17000 Do not keep static references to log levels for JdbcBindingLogging
This commit is contained in:
parent
8658d6377f
commit
3f1ab5fab1
|
@ -19,49 +19,46 @@ public interface JdbcBindingLogging {
|
|||
|
||||
Logger LOGGER = Logger.getLogger( NAME );
|
||||
|
||||
boolean TRACE_ENABLED = LOGGER.isTraceEnabled();
|
||||
boolean DEBUG_ENABLED = LOGGER.isDebugEnabled();
|
||||
|
||||
static void logBinding(int jdbcPosition, int typeCode, Object value) {
|
||||
assert TRACE_ENABLED;
|
||||
|
||||
LOGGER.tracef(
|
||||
"binding parameter (%s:%s) <- [%s]",
|
||||
jdbcPosition,
|
||||
JdbcTypeNameMapper.getTypeName( typeCode ),
|
||||
value
|
||||
);
|
||||
if ( LOGGER.isTraceEnabled() ) {
|
||||
LOGGER.tracef(
|
||||
"binding parameter (%s:%s) <- [%s]",
|
||||
jdbcPosition,
|
||||
JdbcTypeNameMapper.getTypeName( typeCode ),
|
||||
value
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static void logNullBinding(int jdbcPosition, int typeCode) {
|
||||
assert TRACE_ENABLED;
|
||||
|
||||
LOGGER.tracef(
|
||||
"binding parameter (%s:%s) <- [null]",
|
||||
jdbcPosition,
|
||||
JdbcTypeNameMapper.getTypeName( typeCode )
|
||||
);
|
||||
if ( LOGGER.isTraceEnabled() ) {
|
||||
LOGGER.tracef(
|
||||
"binding parameter (%s:%s) <- [null]",
|
||||
jdbcPosition,
|
||||
JdbcTypeNameMapper.getTypeName( typeCode )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static void logBinding(String callableParameterName, int typeCode, Object value) {
|
||||
assert TRACE_ENABLED;
|
||||
|
||||
LOGGER.tracef(
|
||||
"binding parameter (%s:%s) <- [%s]",
|
||||
callableParameterName,
|
||||
JdbcTypeNameMapper.getTypeName( typeCode ),
|
||||
value
|
||||
);
|
||||
if ( LOGGER.isTraceEnabled() ) {
|
||||
LOGGER.tracef(
|
||||
"binding parameter (%s:%s) <- [%s]",
|
||||
callableParameterName,
|
||||
JdbcTypeNameMapper.getTypeName( typeCode ),
|
||||
value
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static void logNullBinding(String callableParameterName, int typeCode) {
|
||||
assert TRACE_ENABLED;
|
||||
|
||||
LOGGER.tracef(
|
||||
"binding parameter (%s:%s) <- [null]",
|
||||
callableParameterName,
|
||||
JdbcTypeNameMapper.getTypeName( typeCode )
|
||||
);
|
||||
if ( LOGGER.isTraceEnabled() ) {
|
||||
LOGGER.tracef(
|
||||
"binding parameter (%s:%s) <- [null]",
|
||||
callableParameterName,
|
||||
JdbcTypeNameMapper.getTypeName( typeCode )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public abstract class BasicBinder<J> implements ValueBinder<J>, Serializable {
|
|||
@Override
|
||||
public final void bind(PreparedStatement st, J value, int index, WrapperOptions options) throws SQLException {
|
||||
if ( value == null ) {
|
||||
if ( JdbcBindingLogging.TRACE_ENABLED ) {
|
||||
if ( JdbcBindingLogging.LOGGER.isTraceEnabled() ) {
|
||||
JdbcBindingLogging.logNullBinding(
|
||||
index,
|
||||
jdbcType.getDefaultSqlTypeCode()
|
||||
|
@ -51,7 +51,7 @@ public abstract class BasicBinder<J> implements ValueBinder<J>, Serializable {
|
|||
doBindNull( st, index, options );
|
||||
}
|
||||
else {
|
||||
if ( JdbcBindingLogging.TRACE_ENABLED ) {
|
||||
if ( JdbcBindingLogging.LOGGER.isTraceEnabled() ) {
|
||||
JdbcBindingLogging.logBinding(
|
||||
index,
|
||||
jdbcType.getDefaultSqlTypeCode(),
|
||||
|
@ -65,7 +65,7 @@ public abstract class BasicBinder<J> implements ValueBinder<J>, Serializable {
|
|||
@Override
|
||||
public final void bind(CallableStatement st, J value, String name, WrapperOptions options) throws SQLException {
|
||||
if ( value == null ) {
|
||||
if ( JdbcBindingLogging.TRACE_ENABLED ) {
|
||||
if ( JdbcBindingLogging.LOGGER.isTraceEnabled() ) {
|
||||
JdbcBindingLogging.logNullBinding(
|
||||
name,
|
||||
jdbcType.getDefaultSqlTypeCode()
|
||||
|
@ -74,7 +74,7 @@ public abstract class BasicBinder<J> implements ValueBinder<J>, Serializable {
|
|||
doBindNull( st, name, options );
|
||||
}
|
||||
else {
|
||||
if ( JdbcBindingLogging.TRACE_ENABLED ) {
|
||||
if ( JdbcBindingLogging.LOGGER.isTraceEnabled() ) {
|
||||
JdbcBindingLogging.logBinding(
|
||||
name,
|
||||
jdbcType.getDefaultSqlTypeCode(),
|
||||
|
|
|
@ -171,7 +171,7 @@ public class UserTypeSqlTypeAdapter<J> implements JdbcType {
|
|||
|
||||
@Override
|
||||
public void bind(PreparedStatement st, J value, int index, WrapperOptions options) throws SQLException {
|
||||
if ( JdbcBindingLogging.TRACE_ENABLED ) {
|
||||
if ( JdbcBindingLogging.LOGGER.isTraceEnabled() ) {
|
||||
if ( value == null ) {
|
||||
JdbcBindingLogging.logNullBinding( index, userType.getSqlType() );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue