Skip to content

Commit a199e59

Browse files
committed
disable TRACE logging from type registries
at least for now - it was just too verbose
1 parent 7935fca commit a199e59

File tree

3 files changed

+51
-56
lines changed

3 files changed

+51
-56
lines changed

hibernate-core/src/main/java/org/hibernate/type/BasicTypeRegistry.java

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -385,51 +385,49 @@ private Map<JavaType<?>, BasicType<?>> registryForJdbcType(JdbcType jdbcType) {
385385

386386
private void applyRegistrationKeys(BasicType<?> type, String[] keys) {
387387
for ( String key : keys ) {
388-
// be safe...
389-
if ( key == null ) {
390-
continue;
388+
if ( key != null ) {
389+
// Use String.intern here as there's a high probability of duplicates combined with long-term usage:
390+
// just running our testsuite would generate 210,000 instances for the String "java.lang.Class" alone.
391+
// Incidentally, this might also help with map lookup efficiency.
392+
key = key.intern();
393+
394+
// Incredibly verbose logging disabled
395+
// LOG.tracef( "Adding type registration %s -> %s", key, type );
396+
397+
final Type old = typesByName.put( key, type );
398+
// if ( old != null && old != type ) {
399+
// LOG.tracef(
400+
// "Type registration key [%s] overrode previous entry : `%s`",
401+
// key,
402+
// old
403+
// );
404+
// }
391405
}
392406

393-
//Use String#intern here as there's high chances of duplicates combined with long term usage:
394-
//just running our testsuite would generate 210,000 instances for the String "java.lang.Class" alone.
395-
//Incidentally this might help with map lookup efficiency too.
396-
key = key.intern();
397-
398-
LOG.tracef( "Adding type registration %s -> %s", key, type );
399-
400-
final Type old = typesByName.put( key, type );
401-
if ( old != null && old != type ) {
402-
LOG.tracef(
403-
"Type registration key [%s] overrode previous entry : `%s`",
404-
key,
405-
old
406-
);
407-
}
408407
}
409408
}
410409

411410
private void applyRegistrationKeys(BasicTypeReference<?> type, String[] keys) {
412411
for ( String key : keys ) {
413-
// be safe...
414-
if ( key == null ) {
415-
continue;
412+
if ( key != null ) {
413+
// Use String.intern here as there's a high probability of duplicates combined with long-term usage:
414+
// just running our testsuite would generate 210,000 instances for the String "java.lang.Class" alone.
415+
// Incidentally, this might also help with map lookup efficiency.
416+
key = key.intern();
417+
418+
// Incredibly verbose logging disabled
419+
// LOG.tracef( "Adding type registration %s -> %s", key, type );
420+
421+
final BasicTypeReference<?> old = typeReferencesByName.put( key, type );
422+
// if ( old != null && old != type ) {
423+
// LOG.tracef(
424+
// "Type registration key [%s] overrode previous entry : `%s`",
425+
// key,
426+
// old
427+
// );
428+
// }
416429
}
417430

418-
//Use String#intern here as there's high chances of duplicates combined with long term usage:
419-
//just running our testsuite would generate 210,000 instances for the String "java.lang.Class" alone.
420-
//Incidentally this might help with map lookup efficiency too.
421-
key = key.intern();
422-
423-
LOG.tracef( "Adding type registration %s -> %s", key, type );
424-
425-
final BasicTypeReference<?> old = typeReferencesByName.put( key, type );
426-
if ( old != null && old != type ) {
427-
LOG.tracef(
428-
"Type registration key [%s] overrode previous entry : `%s`",
429-
key,
430-
old
431-
);
432-
}
433431
}
434432
}
435433
}

hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/spi/JdbcTypeRegistry.java

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
import org.hibernate.type.descriptor.jdbc.internal.JdbcTypeBaseline;
2525
import org.hibernate.type.spi.TypeConfiguration;
2626

27-
import org.jboss.logging.Logger;
28-
2927
import org.checkerframework.checker.nullness.qual.Nullable;
3028

3129
import static org.hibernate.type.descriptor.JdbcTypeNameMapper.isStandardTypeCode;
@@ -40,7 +38,7 @@
4038
* @since 5.3
4139
*/
4240
public class JdbcTypeRegistry implements JdbcTypeBaseline.BaselineTarget, Serializable {
43-
private static final Logger log = Logger.getLogger( JdbcTypeRegistry.class );
41+
// private static final Logger log = Logger.getLogger( JdbcTypeRegistry.class );
4442

4543
private final TypeConfiguration typeConfiguration;
4644
private final ConcurrentHashMap<Integer, JdbcType> descriptorMap = new ConcurrentHashMap<>();
@@ -69,17 +67,17 @@ public TypeConfiguration getTypeConfiguration() {
6967
@Override
7068
public void addDescriptor(JdbcType jdbcType) {
7169
final JdbcType previous = descriptorMap.put( jdbcType.getDefaultSqlTypeCode(), jdbcType );
72-
if ( previous != null && previous != jdbcType ) {
73-
log.tracef( "addDescriptor(%s) replaced previous registration(%s)", jdbcType, previous );
74-
}
70+
// if ( previous != null && previous != jdbcType ) {
71+
// log.tracef( "addDescriptor(%s) replaced previous registration(%s)", jdbcType, previous );
72+
// }
7573
}
7674

7775
@Override
7876
public void addDescriptor(int typeCode, JdbcType jdbcType) {
7977
final JdbcType previous = descriptorMap.put( typeCode, jdbcType );
80-
if ( previous != null && previous != jdbcType ) {
81-
log.tracef( "addDescriptor(%d, %s) replaced previous registration(%s)", typeCode, jdbcType, previous );
82-
}
78+
// if ( previous != null && previous != jdbcType ) {
79+
// log.tracef( "addDescriptor(%d, %s) replaced previous registration(%s)", typeCode, jdbcType, previous );
80+
// }
8381
}
8482

8583
public void addDescriptorIfAbsent(JdbcType jdbcType) {
@@ -100,10 +98,10 @@ public JdbcType getDescriptor(int jdbcTypeCode) {
10098
return descriptor;
10199
}
102100
else {
103-
if ( isStandardTypeCode( jdbcTypeCode ) ) {
104-
log.debugf( "A standard JDBC type code [%s] was not defined in SqlTypeDescriptorRegistry",
105-
jdbcTypeCode );
106-
}
101+
// if ( isStandardTypeCode( jdbcTypeCode ) ) {
102+
// log.debugf( "A standard JDBC type code [%s] was not defined in SqlTypeDescriptorRegistry",
103+
// jdbcTypeCode );
104+
// }
107105

108106
// see if the typecode is part of a known type family...
109107
final JdbcType potentialAlternateDescriptor = getFamilyDescriptor( jdbcTypeCode );
@@ -130,10 +128,10 @@ private JdbcType getFamilyDescriptor(int jdbcTypeCode) {
130128
// todo (6.0) : add a SqlTypeDescriptor#canBeAssignedFrom method ?
131129
return potentialAlternateDescriptor;
132130
}
133-
if ( isStandardTypeCode( potentialAlternateTypeCode ) ) {
134-
log.debugf( "A standard JDBC type code [%s] was not defined in SqlTypeDescriptorRegistry",
135-
potentialAlternateTypeCode );
136-
}
131+
// if ( isStandardTypeCode( potentialAlternateTypeCode ) ) {
132+
// log.debugf( "A standard JDBC type code [%s] was not defined in SqlTypeDescriptorRegistry",
133+
// potentialAlternateTypeCode );
134+
// }
137135
}
138136
}
139137
}

hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/spi/DdlTypeRegistry.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import org.hibernate.type.descriptor.sql.DdlType;
2020
import org.hibernate.type.spi.TypeConfiguration;
2121

22-
import org.jboss.logging.Logger;
2322

2423
/**
2524
* A registry mapping {@link org.hibernate.type.SqlTypes JDBC type codes}
@@ -30,7 +29,7 @@
3029
* @since 6.0
3130
*/
3231
public class DdlTypeRegistry implements Serializable {
33-
private static final Logger log = Logger.getLogger( DdlTypeRegistry.class );
32+
// private static final Logger log = Logger.getLogger( DdlTypeRegistry.class );
3433

3534
private final Map<Integer, DdlType> ddlTypes = new HashMap<>();
3635
private final Map<String, Integer> sqlTypes = new TreeMap<>( String.CASE_INSENSITIVE_ORDER );
@@ -59,7 +58,7 @@ public void addDescriptor(int sqlTypeCode, DdlType ddlType) {
5958
for ( String rawTypeName : previous.getRawTypeNames() ) {
6059
sqlTypes.remove( rawTypeName );
6160
}
62-
log.tracef( "addDescriptor(%d, %s) replaced previous registration(%s)", sqlTypeCode, ddlType, previous );
61+
// log.tracef( "addDescriptor(%d, %s) replaced previous registration(%s)", sqlTypeCode, ddlType, previous );
6362
}
6463
addSqlType( ddlType, sqlTypeCode );
6564
}

0 commit comments

Comments
 (0)