diff --git a/design/logger_id_ranges.adoc b/design/logger_id_ranges.adoc index b9b0023caa2a..58d8e1c3e2b8 100644 --- a/design/logger_id_ranges.adoc +++ b/design/logger_id_ranges.adoc @@ -63,144 +63,44 @@ public interface MappingModelCreationLogger extends BasicLogger { } ---- +== Sub-system logging registry -== `@ValidIdRange` registry - -[width="50%",cols=">s,>s,^2m,^2m",options="header"] +[width="50%",cols=">s,>s,^2m",options="header"] |=== -|`ValidIdRange#min` -|`ValidIdRange#max` -|Channel -|Logger +|Channel (category) +|Id Range (?) +|Purpose -|1 -|10000 -|n/a -|org.hibernate.internal.CoreMessageLogger -|10001 -|15000 -|n/a -|org.hibernate.c3p0.internal.C3P0MessageLogger (extends ConnectionPoolingLogger) +|[[connections-pooling]]org.hibernate.orm.connections.pooling +|<> +|Logging related to connection pooling -|15000 -|20000 +|org.hibernate.orm.boot |n/a -|org.hibernate.internal.EntityManagerMessageLogger +|Logging related to bootstrapping of a SessionFactory / EntityManagerFactory -|20001 -|25000 -|n/a -|org.hibernate.cache.ehcache.EhCacheMessageLogger (extends CoreMessageLogger) +|=== -|25001 -|30000 -|n/a -|org.hibernate.envers.internal.EnversMessageLogger -|25001 -|30000 -|n/a -|org.hibernate.cache.infinispan.util.InfinispanMessageLogger +== MessageLogger id registry -|30001 -|35000 -|n/a -|org.hibernate.proxool.internal.ProxoolMessageLogger (extends ConnectionPoolingLogger) +[width="50%",cols=">s,>s,^2m,^2m",options="header"] +|=== +|`ValidIdRange#min` +|`ValidIdRange#max` +|Logger +|Sub-system (?) -|10000001 -|10001000 -|org.hibernate.orm.url -|org.hibernate.internal.log.UrlMessageBundle -|10001001 +|[[ConnectionPoolingLogger]]10001001 |10001500 -|org.hibernate.orm.connections.pooling |org.hibernate.internal.log.ConnectionPoolingLogger +| <> -|10005001 -|10010000 -|org.hibernate.orm.beans -|org.hibernate.resource.beans.internal.BeansMessageLogger - -|80000001 -|80001000 -|n/a -|org.hibernate.spatial.HSMessageLogger - -|90000001 -|90001000 -|org.hibernate.orm.deprecation -|org.hibernate.internal.log.DeprecationLogger - -|90001001 -|90002000 -|org.hibernate.orm.cache -|org.hibernate.cache.spi.SecondLevelCacheLogger - -|90002001 -|90003000 +|1 +|2 +|org.hibernate.TheLogger |n/a -|org.hibernate.internal.log.UnsupportedLogger - -|90003001 -|90003500 -|org.hibernate.orm.query -|org.hibernate.query.spi.QueryLogger - -|90003501 -|90004000 -|org.hibernate.orm.query.hql -|org.hibernate.query.hql.HqlLogging - -|90004001 -|90005000 -|org.hibernate.orm.sql.exec -|org.hibernate.sql.exec.SqlExecLogger - -|90005001 -|90005100 -|org.hibernate.orm.sql.results -|org.hibernate.sql.results.ResultsLogger - -|90005101 -|90005200 -|org.hibernate.orm.sql.results.loading.collection -|org.hibernate.sql.results.graph.collection.CollectionLoadingLogger - -|90005201 -|90005300 -|org.hibernate.orm.sql.results.loading.entity -|org.hibernate.sql.results.graph.entity.EntityLoadingLogger - -|90005301 -|90005400 -|org.hibernate.orm.sql.results.loading.composite -|org.hibernate.sql.results.graph.embeddable.EmbeddableLoadingLogger - -|90005401 -|90005500 -|org.hibernate.orm.sql.ast.tree -|org.hibernate.sql.ast.tree.SqlAstTreeLogger - -|90005501 -|90005600 -|org.hibernate.orm.boot.jaxb -|org.hibernate.boot.jaxb.JaxbLogger - -|90005601 -|90005700 -|org.hibernate.envers.boot -|org.hibernate.envers.boot.EnversBootLogger - -|90005701 -|90005800 -|org.hibernate.orm.model.mapping.creation -|org.hibernate.metamodel.mapping.MappingModelCreationLogger - -|90005801 -|90005900 -|org.hibernate.orm.sql.results.loading -|org.hibernate.sql.results.LoadingLogger |=== diff --git a/documentation/documentation.gradle b/documentation/documentation.gradle index 19c9a9ad329e..b8cc208a453f 100644 --- a/documentation/documentation.gradle +++ b/documentation/documentation.gradle @@ -235,6 +235,8 @@ task renderMigrationGuide(type: AsciidoctorTask, group: 'Documentation') {task-> } } +tasks.buildDocsForPublishing.dependsOn generateHibernateReports + tasks.withType(AsciidoctorTask).all { baseDirFollowsSourceDir() outputOptions { diff --git a/hibernate-c3p0/src/main/java/org/hibernate/c3p0/internal/C3P0ConnectionProvider.java b/hibernate-c3p0/src/main/java/org/hibernate/c3p0/internal/C3P0ConnectionProvider.java index 9bfe1e5f49a1..a08ca889f224 100644 --- a/hibernate-c3p0/src/main/java/org/hibernate/c3p0/internal/C3P0ConnectionProvider.java +++ b/hibernate-c3p0/src/main/java/org/hibernate/c3p0/internal/C3P0ConnectionProvider.java @@ -29,7 +29,8 @@ import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.spi.Stoppable; -import org.jboss.logging.Logger; +import static org.hibernate.c3p0.internal.C3P0MessageLogger.C3P0_LOGGER; +import static org.hibernate.c3p0.internal.C3P0MessageLogger.C3P0_MSG_LOGGER; /** * A connection provider that uses a C3P0 connection pool. Hibernate will use this by @@ -41,11 +42,6 @@ public class C3P0ConnectionProvider implements ConnectionProvider, Configurable, Stoppable, ServiceRegistryAwareService { - private static final C3P0MessageLogger LOG = Logger.getMessageLogger( - C3P0MessageLogger.class, - C3P0ConnectionProvider.class.getName() - ); - //swaldman 2006-08-28: define c3p0-style configuration parameters for properties with // hibernate-specific overrides to detect and warn about conflicting // declarations @@ -112,21 +108,21 @@ public void configure(Map props) { final String jdbcUrl = (String) props.get( Environment.URL ); final Properties connectionProps = ConnectionProviderInitiator.getConnectionProperties( props ); - LOG.c3p0UsingDriver( jdbcDriverClass, jdbcUrl ); - LOG.connectionProperties( ConfigurationHelper.maskOut( connectionProps, "password" ) ); + C3P0_MSG_LOGGER.c3p0UsingDriver( jdbcDriverClass, jdbcUrl ); + C3P0_MSG_LOGGER.connectionProperties( ConfigurationHelper.maskOut( connectionProps, "password" ) ); autocommit = ConfigurationHelper.getBoolean( Environment.AUTOCOMMIT, props ); - LOG.autoCommitMode( autocommit ); + C3P0_MSG_LOGGER.autoCommitMode( autocommit ); if ( jdbcDriverClass == null ) { - LOG.jdbcDriverNotSpecified( Environment.DRIVER ); + C3P0_MSG_LOGGER.jdbcDriverNotSpecified( Environment.DRIVER ); } else { try { serviceRegistry.getService( ClassLoaderService.class ).classForName( jdbcDriverClass ); } catch (ClassLoadingException e) { - throw new ClassLoadingException( LOG.jdbcDriverNotFound( jdbcDriverClass ), e ); + throw new ClassLoadingException( C3P0_MSG_LOGGER.jdbcDriverNotFound( jdbcDriverClass ), e ); } } @@ -187,12 +183,12 @@ public void configure(Map props) { ds = DataSources.pooledDataSource( unpooled, allProps ); } catch (Exception e) { - LOG.error( LOG.unableToInstantiateC3p0ConnectionPool(), e ); - throw new HibernateException( LOG.unableToInstantiateC3p0ConnectionPool(), e ); + C3P0_LOGGER.error( C3P0_MSG_LOGGER.unableToInstantiateC3p0ConnectionPool(), e ); + throw new HibernateException( C3P0_MSG_LOGGER.unableToInstantiateC3p0ConnectionPool(), e ); } isolation = ConnectionProviderInitiator.extractIsolation( props ); - LOG.jdbcIsolationLevel( ConnectionProviderInitiator.toIsolationNiceName( isolation ) ); + C3P0_MSG_LOGGER.jdbcIsolationLevel( ConnectionProviderInitiator.toIsolationNiceName( isolation ) ); } @Override @@ -220,7 +216,7 @@ private void setOverwriteProperty( } private void warnPropertyConflict(String hibernateStyle, String c3p0Style) { - LOG.bothHibernateAndC3p0StylesSet( hibernateStyle, c3p0Style ); + C3P0_MSG_LOGGER.bothHibernateAndC3p0StylesSet( hibernateStyle, c3p0Style ); } @Override @@ -229,7 +225,7 @@ public void stop() { DataSources.destroy( ds ); } catch (SQLException sqle) { - LOG.unableToDestroyC3p0ConnectionPool( sqle ); + C3P0_MSG_LOGGER.unableToDestroyC3p0ConnectionPool( sqle ); } } diff --git a/hibernate-c3p0/src/main/java/org/hibernate/c3p0/internal/C3P0MessageLogger.java b/hibernate-c3p0/src/main/java/org/hibernate/c3p0/internal/C3P0MessageLogger.java index 448ba0007f72..a6ccaa5cd2f0 100644 --- a/hibernate-c3p0/src/main/java/org/hibernate/c3p0/internal/C3P0MessageLogger.java +++ b/hibernate-c3p0/src/main/java/org/hibernate/c3p0/internal/C3P0MessageLogger.java @@ -9,11 +9,14 @@ import java.sql.SQLException; import org.hibernate.internal.log.ConnectionPoolingLogger; +import org.hibernate.internal.log.SubSystemLogging; +import org.jboss.logging.Logger; import org.jboss.logging.annotations.Cause; import org.jboss.logging.annotations.LogMessage; import org.jboss.logging.annotations.Message; import org.jboss.logging.annotations.MessageLogger; +import org.jboss.logging.annotations.ValidIdRange; import static org.jboss.logging.Logger.Level.INFO; import static org.jboss.logging.Logger.Level.WARN; @@ -25,7 +28,16 @@ * New messages must be added after the last message defined to ensure message codes are unique. */ @MessageLogger(projectCode = "HHH") +@ValidIdRange( min = 10001, max = 15000 ) +@SubSystemLogging( + name = C3P0MessageLogger.NAME, + description = "Logging related to the C3P0 connection pool" +) public interface C3P0MessageLogger extends ConnectionPoolingLogger { + String NAME = ConnectionPoolingLogger.LOGGER_NAME + ".c3p0"; + + Logger C3P0_LOGGER = Logger.getLogger( NAME ); + C3P0MessageLogger C3P0_MSG_LOGGER = Logger.getMessageLogger( C3P0MessageLogger.class, NAME ); /** * Log a message (WARN) about conflicting {@code hibernate.c3p0.XYZ} and {@code c3p0.XYZ} settings diff --git a/hibernate-core/src/main/java/org/hibernate/boot/BootLogging.java b/hibernate-core/src/main/java/org/hibernate/boot/BootLogging.java index 53e04ae90812..7f56a9cafdeb 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/BootLogging.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/BootLogging.java @@ -6,26 +6,22 @@ */ package org.hibernate.boot; +import org.hibernate.internal.log.SubSystemLogging; + import org.jboss.logging.Logger; -import static org.hibernate.internal.CoreLogging.subsystemLoggerName; /** * Logging related to Hibernate bootstrapping */ -public class BootLogging { - public static String NAME = subsystemLoggerName( "boot" ); - - public static final Logger LOGGER = Logger.getLogger( NAME ); - - public static String subLoggerName(String subPath) { - return NAME + "." + subPath; - } - - public static Logger subLogger(String subPath) { - return Logger.getLogger( subLoggerName( subPath ) ); - } +@SubSystemLogging( + name = BootLogging.NAME, + description = "Logging related to bootstrapping of a SessionFactory / EntityManagerFactory" +) +public interface BootLogging { + String NAME = SubSystemLogging.BASE + ".boot"; + Logger BOOT_LOGGER = Logger.getLogger( NAME ); - public static final boolean DEBUG_ENABLED = LOGGER.isDebugEnabled(); - public static final boolean TRACE_ENABLED = LOGGER.isTraceEnabled(); + boolean DEBUG_ENABLED = BOOT_LOGGER.isDebugEnabled(); + boolean TRACE_ENABLED = BOOT_LOGGER.isTraceEnabled(); } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/jaxb/JaxbLogger.java b/hibernate-core/src/main/java/org/hibernate/boot/jaxb/JaxbLogger.java index 453e30788291..f64276a68b85 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/jaxb/JaxbLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/jaxb/JaxbLogger.java @@ -6,6 +6,9 @@ */ package org.hibernate.boot.jaxb; +import org.hibernate.boot.BootLogging; +import org.hibernate.internal.log.SubSystemLogging; + import org.jboss.logging.BasicLogger; import org.jboss.logging.Logger; import org.jboss.logging.annotations.MessageLogger; @@ -16,13 +19,14 @@ */ @MessageLogger( projectCode = "HHH" ) @ValidIdRange( min = 90005501, max = 90005600 ) +@SubSystemLogging( + name = JaxbLogger.LOGGER_NAME, + description = "Logging related to JAXB processing" +) public interface JaxbLogger extends BasicLogger { - String LOGGER_NAME = "org.hibernate.orm.boot.jaxb"; + String LOGGER_NAME = BootLogging.NAME + "jaxb"; - JaxbLogger JAXB_LOGGER = Logger.getMessageLogger( - JaxbLogger.class, - LOGGER_NAME - ); + JaxbLogger JAXB_LOGGER = Logger.getMessageLogger( JaxbLogger.class, LOGGER_NAME ); boolean TRACE_ENABLED = JAXB_LOGGER.isTraceEnabled(); boolean DEBUG_ENABLED = JAXB_LOGGER.isDebugEnabled(); diff --git a/hibernate-core/src/main/java/org/hibernate/boot/query/BootQueryLogging.java b/hibernate-core/src/main/java/org/hibernate/boot/query/BootQueryLogging.java index c3fbd88a5a21..990e7d3face1 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/query/BootQueryLogging.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/query/BootQueryLogging.java @@ -7,15 +7,21 @@ package org.hibernate.boot.query; import org.hibernate.boot.BootLogging; +import org.hibernate.internal.log.SubSystemLogging; import org.jboss.logging.Logger; /** * @author Steve Ebersole */ -public class BootQueryLogging { - public static final Logger LOGGER = BootLogging.subLogger( "query" ); +@SubSystemLogging( + name = BootQueryLogging.NAME, + description = "Logging related to processing of named-queries" +) +public interface BootQueryLogging { + String NAME = BootLogging.NAME + ".query"; + Logger BOOT_QUERY_LOGGER = Logger.getLogger( NAME ); - public static final boolean DEBUG_ENABLED = LOGGER.isDebugEnabled(); - public static final boolean TRACE_ENABLED = LOGGER.isTraceEnabled(); + boolean DEBUG_ENABLED = BOOT_QUERY_LOGGER.isDebugEnabled(); + boolean TRACE_ENABLED = BOOT_QUERY_LOGGER.isTraceEnabled(); } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/query/HbmResultSetMappingDescriptor.java b/hibernate-core/src/main/java/org/hibernate/boot/query/HbmResultSetMappingDescriptor.java index b3f0782864ab..54222fe80cc7 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/query/HbmResultSetMappingDescriptor.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/query/HbmResultSetMappingDescriptor.java @@ -85,7 +85,7 @@ public HbmResultSetMappingDescriptor( MetadataBuildingContext context) { this.registrationName = hbmResultSetMapping.getName(); - BootLogging.LOGGER.debugf( + BootLogging.BOOT_LOGGER.debugf( "Creating explicit HbmResultSetMappingDescriptor : %s", registrationName ); @@ -260,7 +260,7 @@ public String getRegistrationName() { @Override public NamedResultSetMappingMemento resolve(ResultSetMappingResolutionContext resolutionContext) { - BootQueryLogging.LOGGER.debugf( + BootQueryLogging.BOOT_QUERY_LOGGER.debugf( "Resolving HbmResultSetMappingDescriptor into memento for [%s]", registrationName ); @@ -349,7 +349,7 @@ public EntityResultDescriptor( ); } - BootQueryLogging.LOGGER.debugf( + BootQueryLogging.BOOT_QUERY_LOGGER.debugf( "Creating EntityResultDescriptor (%s : %s) for ResultSet mapping - %s", tableAlias, entityName, @@ -373,7 +373,7 @@ public EntityResultDescriptor( @Override public ResultMemento resolve(ResultSetMappingResolutionContext resolutionContext) { - BootQueryLogging.LOGGER.debugf( + BootQueryLogging.BOOT_QUERY_LOGGER.debugf( "Resolving HBM EntityResultDescriptor into memento - %s : %s (%s)", tableAlias, entityName, @@ -527,7 +527,7 @@ public PropertyFetchDescriptor( } } - BootQueryLogging.LOGGER.debugf( + BootQueryLogging.BOOT_QUERY_LOGGER.debugf( "Creating PropertyFetchDescriptor (%s : %s) for ResultSet mapping - %s", parent, propertyPath, @@ -645,7 +645,7 @@ private static List extractColumnAliases( @Override public FetchMemento resolve(ResultSetMappingResolutionContext resolutionContext) { - BootQueryLogging.LOGGER.debugf( + BootQueryLogging.BOOT_QUERY_LOGGER.debugf( "Resolving HBM PropertyFetchDescriptor into memento - %s : %s", parent, propertyPath @@ -758,7 +758,7 @@ public String getFetchablePath() { @Override public FetchMemento resolve(ResultSetMappingResolutionContext resolutionContext) { - BootQueryLogging.LOGGER.debugf( + BootQueryLogging.BOOT_QUERY_LOGGER.debugf( "Resolving HBM JoinDescriptor into memento - %s : %s . %s", tableAlias, ownerTableAlias, @@ -873,7 +873,7 @@ public CollectionResultDescriptor( ); } - BootQueryLogging.LOGGER.debugf( + BootQueryLogging.BOOT_QUERY_LOGGER.debugf( "Creating CollectionResultDescriptor (%s : %s)", tableAlias, collectionPath @@ -895,7 +895,7 @@ public CollectionResultDescriptor( @Override public ResultMemento resolve(ResultSetMappingResolutionContext resolutionContext) { - BootQueryLogging.LOGGER.debugf( + BootQueryLogging.BOOT_QUERY_LOGGER.debugf( "Resolving HBM CollectionResultDescriptor into memento - %s : %s", tableAlias, collectionPath @@ -942,7 +942,7 @@ public ScalarDescriptor(String columnName, String hibernateTypeName) { this.columnName = columnName; this.hibernateTypeName = hibernateTypeName; - BootQueryLogging.LOGGER.debugf( + BootQueryLogging.BOOT_QUERY_LOGGER.debugf( "Creating ScalarDescriptor (%s)", columnName ); @@ -954,7 +954,7 @@ public ScalarDescriptor(JaxbHbmNativeQueryScalarReturnType hbmScalarReturn) { @Override public ResultMementoBasicStandard resolve(ResultSetMappingResolutionContext resolutionContext) { - BootQueryLogging.LOGGER.debugf( + BootQueryLogging.BOOT_QUERY_LOGGER.debugf( "Resolving HBM ScalarDescriptor into memento - %s", columnName ); diff --git a/hibernate-core/src/main/java/org/hibernate/boot/query/ImplicitHbmResultSetMappingDescriptorBuilder.java b/hibernate-core/src/main/java/org/hibernate/boot/query/ImplicitHbmResultSetMappingDescriptorBuilder.java index 7249be0d60b8..b13c4378903b 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/query/ImplicitHbmResultSetMappingDescriptorBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/query/ImplicitHbmResultSetMappingDescriptorBuilder.java @@ -46,7 +46,7 @@ public class ImplicitHbmResultSetMappingDescriptorBuilder { public ImplicitHbmResultSetMappingDescriptorBuilder(String queryRegistrationName, MetadataBuildingContext metadataBuildingContext) { this.registrationName = queryRegistrationName; - BootQueryLogging.LOGGER.debugf( + BootQueryLogging.BOOT_QUERY_LOGGER.debugf( "Creating implicit HbmResultSetMappingDescriptor for named-native-query : %s", registrationName ); diff --git a/hibernate-core/src/main/java/org/hibernate/boot/query/SqlResultSetMappingDescriptor.java b/hibernate-core/src/main/java/org/hibernate/boot/query/SqlResultSetMappingDescriptor.java index a0ddfc43da3e..0c1fbeea9387 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/query/SqlResultSetMappingDescriptor.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/query/SqlResultSetMappingDescriptor.java @@ -151,7 +151,7 @@ public JpaColumnResultDescriptor( @Override public ResultMemento resolve(ResultSetMappingResolutionContext resolutionContext) { - BootQueryLogging.LOGGER.debugf( + BootQueryLogging.BOOT_QUERY_LOGGER.debugf( "Generating ScalarResultMappingMemento for JPA ColumnResult(%s) for ResultSet mapping `%s`", columnResult.name(), mappingName @@ -207,7 +207,7 @@ public ConstructorResultDescriptor( @Override public ResultMemento resolve(ResultSetMappingResolutionContext resolutionContext) { - BootQueryLogging.LOGGER.debugf( + BootQueryLogging.BOOT_QUERY_LOGGER.debugf( "Generating InstantiationResultMappingMemento for JPA ConstructorResult(%s) for ResultSet mapping `%s`", targetJavaType.getName(), mappingName diff --git a/hibernate-core/src/main/java/org/hibernate/bytecode/BytecodeLogging.java b/hibernate-core/src/main/java/org/hibernate/bytecode/BytecodeLogging.java index 8fddd862bfaf..1bc5fa84be56 100644 --- a/hibernate-core/src/main/java/org/hibernate/bytecode/BytecodeLogging.java +++ b/hibernate-core/src/main/java/org/hibernate/bytecode/BytecodeLogging.java @@ -6,19 +6,22 @@ */ package org.hibernate.bytecode; +import org.hibernate.boot.jaxb.JaxbLogger; +import org.hibernate.internal.log.SubSystemLogging; + import org.jboss.logging.Logger; /** * @author Steve Ebersole */ +@SubSystemLogging( + name = BytecodeLogging.LOGGER_NAME, + description = "Logging related to bytecode handling" +) public interface BytecodeLogging { - String NAME = "org.hibernate.orm.bytecode"; - - Logger LOGGER = Logger.getLogger( NAME ); + String LOGGER_NAME = SubSystemLogging.BASE + "bytecode"; - static String subLoggerName(String subName) { - return NAME + "." + subName; - } + Logger LOGGER = Logger.getLogger( LOGGER_NAME ); boolean TRACE_ENABLED = LOGGER.isTraceEnabled(); boolean DEBUG_ENABLED = LOGGER.isDebugEnabled(); diff --git a/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/interceptor/BytecodeInterceptorLogging.java b/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/interceptor/BytecodeInterceptorLogging.java index 4ae37a10453a..1c14de6f75eb 100644 --- a/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/interceptor/BytecodeInterceptorLogging.java +++ b/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/interceptor/BytecodeInterceptorLogging.java @@ -7,6 +7,7 @@ package org.hibernate.bytecode.enhance.spi.interceptor; import org.hibernate.bytecode.BytecodeLogging; +import org.hibernate.internal.log.SubSystemLogging; import org.jboss.logging.BasicLogger; import org.jboss.logging.Logger; @@ -22,12 +23,16 @@ */ @MessageLogger(projectCode = "HHH") @ValidIdRange(min = 90005901, max = 90006000) +@SubSystemLogging( + name = BytecodeInterceptorLogging.LOGGER_NAME, + description = "Logging related to bytecode-based interception" +) public interface BytecodeInterceptorLogging extends BasicLogger { String SUB_NAME = "interceptor"; - String NAME = BytecodeLogging.subLoggerName(SUB_NAME); + String LOGGER_NAME = BytecodeLogging.LOGGER_NAME + "." + SUB_NAME; - Logger LOGGER = Logger.getLogger(NAME); - BytecodeInterceptorLogging MESSAGE_LOGGER = Logger.getMessageLogger(BytecodeInterceptorLogging.class, NAME); + Logger LOGGER = Logger.getLogger( LOGGER_NAME ); + BytecodeInterceptorLogging MESSAGE_LOGGER = Logger.getMessageLogger(BytecodeInterceptorLogging.class, LOGGER_NAME ); boolean TRACE_ENABLED = LOGGER.isTraceEnabled(); boolean DEBUG_ENABLED = LOGGER.isDebugEnabled(); diff --git a/hibernate-core/src/main/java/org/hibernate/cache/internal/QueryResultsCacheImpl.java b/hibernate-core/src/main/java/org/hibernate/cache/internal/QueryResultsCacheImpl.java index f2b821bbb561..b3eaceab41ad 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/internal/QueryResultsCacheImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/internal/QueryResultsCacheImpl.java @@ -19,6 +19,9 @@ import org.hibernate.cache.spi.TimestampsCache; import org.hibernate.engine.spi.SharedSessionContractImplementor; +import static org.hibernate.cache.spi.SecondLevelCacheLogger.DEBUG_ENABLED; +import static org.hibernate.cache.spi.SecondLevelCacheLogger.L2CACHE_LOGGER; + /** * The standard implementation of the Hibernate QueryCache interface. Works * hind-in-hand with {@link TimestampsCache} to help in recognizing @@ -49,8 +52,8 @@ public boolean put( final QueryKey key, final List results, final SharedSessionContractImplementor session) throws HibernateException { - if ( SecondLevelCacheLogger.DEBUG_ENABLED ) { - SecondLevelCacheLogger.INSTANCE.debugf( "Caching query results in region: %s; timestamp=%s", cacheRegion.getName(), session.getTransactionStartTimestamp() ); + if ( DEBUG_ENABLED ) { + L2CACHE_LOGGER.debugf( "Caching query results in region: %s; timestamp=%s", cacheRegion.getName(), session.getTransactionStartTimestamp() ); } final CacheItem cacheItem = new CacheItem( @@ -78,27 +81,27 @@ public List get( final QueryKey key, final Set spaces, final SharedSessionContractImplementor session) throws HibernateException { - if ( SecondLevelCacheLogger.DEBUG_ENABLED ) { - SecondLevelCacheLogger.INSTANCE.debugf( "Checking cached query results in region: %s", cacheRegion.getName() ); + if ( DEBUG_ENABLED ) { + L2CACHE_LOGGER.debugf( "Checking cached query results in region: %s", cacheRegion.getName() ); } final CacheItem cacheItem = getCachedData( key, session ); if ( cacheItem == null ) { - if ( SecondLevelCacheLogger.DEBUG_ENABLED ) { - SecondLevelCacheLogger.INSTANCE.debug( "Query results were not found in cache" ); + if ( DEBUG_ENABLED ) { + L2CACHE_LOGGER.debug( "Query results were not found in cache" ); } return null; } if ( !timestampsCache.isUpToDate( spaces, cacheItem.timestamp, session ) ) { - if ( SecondLevelCacheLogger.DEBUG_ENABLED ) { - SecondLevelCacheLogger.INSTANCE.debug( "Cached query results were not up-to-date" ); + if ( DEBUG_ENABLED ) { + L2CACHE_LOGGER.debug( "Cached query results were not up-to-date" ); } return null; } - if ( SecondLevelCacheLogger.DEBUG_ENABLED ) { - SecondLevelCacheLogger.INSTANCE.debug( "Returning cached query results" ); + if ( DEBUG_ENABLED ) { + L2CACHE_LOGGER.debug( "Returning cached query results" ); } return deepCopy( cacheItem.results ); @@ -109,27 +112,27 @@ public List get( final QueryKey key, final String[] spaces, final SharedSessionContractImplementor session) throws HibernateException { - if ( SecondLevelCacheLogger.DEBUG_ENABLED ) { - SecondLevelCacheLogger.INSTANCE.debugf( "Checking cached query results in region: %s", cacheRegion.getName() ); + if ( DEBUG_ENABLED ) { + L2CACHE_LOGGER.debugf( "Checking cached query results in region: %s", cacheRegion.getName() ); } final CacheItem cacheItem = getCachedData( key, session ); if ( cacheItem == null ) { - if ( SecondLevelCacheLogger.DEBUG_ENABLED ) { - SecondLevelCacheLogger.INSTANCE.debug( "Query results were not found in cache" ); + if ( DEBUG_ENABLED ) { + L2CACHE_LOGGER.debug( "Query results were not found in cache" ); } return null; } if ( !timestampsCache.isUpToDate( spaces, cacheItem.timestamp, session ) ) { - if ( SecondLevelCacheLogger.DEBUG_ENABLED ) { - SecondLevelCacheLogger.INSTANCE.debug( "Cached query results were not up-to-date" ); + if ( DEBUG_ENABLED ) { + L2CACHE_LOGGER.debug( "Cached query results were not up-to-date" ); } return null; } - if ( SecondLevelCacheLogger.DEBUG_ENABLED ) { - SecondLevelCacheLogger.INSTANCE.debug( "Returning cached query results" ); + if ( DEBUG_ENABLED ) { + L2CACHE_LOGGER.debug( "Returning cached query results" ); } return deepCopy( cacheItem.results ); diff --git a/hibernate-core/src/main/java/org/hibernate/cache/spi/AbstractRegionFactory.java b/hibernate-core/src/main/java/org/hibernate/cache/spi/AbstractRegionFactory.java index 5986250ad59f..b8ecfaa62f6b 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/spi/AbstractRegionFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/spi/AbstractRegionFactory.java @@ -17,6 +17,8 @@ import org.hibernate.cache.spi.support.SimpleTimestamper; import org.hibernate.engine.spi.SharedSessionContractImplementor; +import static org.hibernate.cache.spi.SecondLevelCacheLogger.L2CACHE_LOGGER; + /** * @author Steve Ebersole */ @@ -95,7 +97,7 @@ public final void start(SessionFactoryOptions settings, Map confi } } else { - SecondLevelCacheLogger.INSTANCE.attemptToStartAlreadyStartedCacheProvider(); + L2CACHE_LOGGER.attemptToStartAlreadyStartedCacheProvider(); } } @@ -115,7 +117,7 @@ public final void stop() { } } else { - SecondLevelCacheLogger.INSTANCE.attemptToStopAlreadyStoppedCacheProvider(); + L2CACHE_LOGGER.attemptToStopAlreadyStoppedCacheProvider(); } } diff --git a/hibernate-core/src/main/java/org/hibernate/cache/spi/SecondLevelCacheLogger.java b/hibernate-core/src/main/java/org/hibernate/cache/spi/SecondLevelCacheLogger.java index 1eb085a3fa6a..596ac47e5e57 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/spi/SecondLevelCacheLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/spi/SecondLevelCacheLogger.java @@ -6,6 +6,7 @@ */ package org.hibernate.cache.spi; +import org.hibernate.internal.log.SubSystemLogging; import org.hibernate.metamodel.model.domain.NavigableRole; import org.jboss.logging.BasicLogger; @@ -23,13 +24,17 @@ */ @MessageLogger( projectCode = "HHH" ) @ValidIdRange( min = 90001001, max = 90002000 ) +@SubSystemLogging( + name = SecondLevelCacheLogger.LOGGER_NAME, + description = "Logging related to Hibernate second-level caching" +) public interface SecondLevelCacheLogger extends BasicLogger { - String LOGGER_NAME = "org.hibernate.orm.cache"; + String LOGGER_NAME = SubSystemLogging.BASE + ".cache"; - SecondLevelCacheLogger INSTANCE = Logger.getMessageLogger( SecondLevelCacheLogger.class, LOGGER_NAME ); + SecondLevelCacheLogger L2CACHE_LOGGER = Logger.getMessageLogger( SecondLevelCacheLogger.class, LOGGER_NAME ); - boolean DEBUG_ENABLED = INSTANCE.isDebugEnabled(); - boolean TRACE_ENABLED = INSTANCE.isTraceEnabled(); + boolean DEBUG_ENABLED = L2CACHE_LOGGER.isDebugEnabled(); + boolean TRACE_ENABLED = L2CACHE_LOGGER.isTraceEnabled(); int NAMESPACE = 90001000; diff --git a/hibernate-core/src/main/java/org/hibernate/cache/spi/support/AbstractReadWriteAccess.java b/hibernate-core/src/main/java/org/hibernate/cache/spi/support/AbstractReadWriteAccess.java index 00e856aa33d3..2040b6137df7 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/spi/support/AbstractReadWriteAccess.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/spi/support/AbstractReadWriteAccess.java @@ -21,6 +21,8 @@ import org.jboss.logging.Logger; +import static org.hibernate.cache.spi.SecondLevelCacheLogger.L2CACHE_LOGGER; + /** * @author Steve Ebersole */ @@ -181,7 +183,7 @@ protected void decrementLock(SharedSessionContractImplementor session, Object ke } protected void handleLockExpiry(SharedSessionContractImplementor session, Object key, Lockable lock) { - SecondLevelCacheLogger.INSTANCE.softLockedCacheExpired( getRegion().getName(), key ); + L2CACHE_LOGGER.softLockedCacheExpired( getRegion().getName(), key ); log.info( "Cached entry expired : " + key ); // create new lock that times out immediately diff --git a/hibernate-core/src/main/java/org/hibernate/cache/spi/support/EntityReadOnlyAccess.java b/hibernate-core/src/main/java/org/hibernate/cache/spi/support/EntityReadOnlyAccess.java index 2a61b8f3d735..caa498edf95b 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/spi/support/EntityReadOnlyAccess.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/spi/support/EntityReadOnlyAccess.java @@ -16,6 +16,8 @@ import org.jboss.logging.Logger; +import static org.hibernate.cache.spi.SecondLevelCacheLogger.L2CACHE_LOGGER; + /** * Standard support for {@link org.hibernate.cache.spi.access.EntityDataAccess} * using the {@link AccessType#READ_ONLY} access type. @@ -32,7 +34,7 @@ public EntityReadOnlyAccess( EntityDataCachingConfig config) { super( region, cacheKeysFactory, storageAccess ); if ( config.isMutable() ) { - SecondLevelCacheLogger.INSTANCE.readOnlyCachingMutableEntity( config.getNavigableRole() ); + L2CACHE_LOGGER.readOnlyCachingMutableEntity( config.getNavigableRole() ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/cache/spi/support/NaturalIdReadOnlyAccess.java b/hibernate-core/src/main/java/org/hibernate/cache/spi/support/NaturalIdReadOnlyAccess.java index f115cfbbebf4..1cb1e6f82ac1 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/spi/support/NaturalIdReadOnlyAccess.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/spi/support/NaturalIdReadOnlyAccess.java @@ -14,6 +14,8 @@ import org.hibernate.cache.spi.access.SoftLock; import org.hibernate.engine.spi.SharedSessionContractImplementor; +import static org.hibernate.cache.spi.SecondLevelCacheLogger.L2CACHE_LOGGER; + /** * Standard support for {@link org.hibernate.cache.spi.access.NaturalIdDataAccess} * using the {@link AccessType#READ_ONLY} access type. @@ -28,7 +30,7 @@ public NaturalIdReadOnlyAccess( NaturalIdDataCachingConfig config) { super( region, keysFactory, storageAccess, config ); if ( config.isMutable() ) { - SecondLevelCacheLogger.INSTANCE.readOnlyCachingMutableNaturalId( config.getNavigableRole() ); + L2CACHE_LOGGER.readOnlyCachingMutableNaturalId( config.getNavigableRole() ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java index f7583e33e2d5..af716e7aefdf 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java @@ -365,7 +365,7 @@ private static ManagedBean createCustomType( } else { // log a "warning" - BootLogging.LOGGER.debugf( + BootLogging.BOOT_LOGGER.debugf( "Custom collection-type (`%s`) assigned to attribute (`%s`) does not implement `%s`, but its `@CollectionType` defined parameters", implementation.getName(), role, @@ -427,7 +427,7 @@ public static ManagedBean resolveCustomType( } else { // log a "warning" - BootLogging.LOGGER.debugf( + BootLogging.BOOT_LOGGER.debugf( "Custom collection-type (`%s`) assigned to attribute (`%s`) does not implement `%s`, but its `@CollectionType` defined parameters", typeImpl.getName(), attributeKey, diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/NaturalIdResolutionsImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/NaturalIdResolutionsImpl.java index 85e8e4062e83..0655dca2fcf2 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/NaturalIdResolutionsImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/NaturalIdResolutionsImpl.java @@ -67,7 +67,7 @@ public boolean cacheResolution(Object id, Object naturalId, EntityMappingType en @Override public void cacheResolutionFromLoad(Object id, Object naturalId, EntityMappingType entityDescriptor) { - NaturalIdLogging.LOGGER.debugf( + NaturalIdLogging.NATURAL_ID_LOGGER.debugf( "Caching resolution natural-id resolution from load (%s) : `%s` -> `%s`", entityDescriptor.getEntityName(), naturalId, @@ -101,7 +101,7 @@ private boolean cacheResolutionLocally(Object id, Object naturalId, EntityMappin assert entityDescriptor.getNaturalIdMapping() != null; assert isValidValue( naturalId, entityDescriptor ); - NaturalIdLogging.LOGGER.debugf( + NaturalIdLogging.NATURAL_ID_LOGGER.debugf( "Locally caching natural-id resolution (%s) : `%s` -> `%s`", entityDescriptor.getEntityName(), naturalId, @@ -172,7 +172,7 @@ public void manageLocalResolution( @Override public Object removeLocalResolution(Object id, Object naturalId, EntityMappingType entityDescriptor) { - NaturalIdLogging.LOGGER.debugf( + NaturalIdLogging.NATURAL_ID_LOGGER.debugf( "Removing locally cached natural-id resolution (%s) : `%s` -> `%s`", entityDescriptor.getEntityName(), naturalId, diff --git a/hibernate-core/src/main/java/org/hibernate/graph/internal/GraphParserLogging.java b/hibernate-core/src/main/java/org/hibernate/graph/internal/GraphParserLogging.java new file mode 100644 index 000000000000..f43290c36c8f --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/graph/internal/GraphParserLogging.java @@ -0,0 +1,27 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later + * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html + */ +package org.hibernate.graph.internal; + +import org.hibernate.internal.log.SubSystemLogging; + +import org.jboss.logging.Logger; + +/** + * @author Steve Ebersole + */ +@SubSystemLogging( + name = GraphParserLogging.LOGGER_NAME, + description = "Logging related to Hibernate's `GraphParser` for parsing entity-graphs from String representations" +) +public interface GraphParserLogging { + String LOGGER_NAME = SubSystemLogging.BASE + ".graph.parsing"; + + Logger PARSING_LOGGER = Logger.getLogger( LOGGER_NAME ); + + boolean DEBUG_ENABLED = PARSING_LOGGER.isDebugEnabled(); + boolean TRACE_ENABLED = PARSING_LOGGER.isTraceEnabled(); +} diff --git a/hibernate-core/src/main/java/org/hibernate/graph/internal/parse/GraphParser.java b/hibernate-core/src/main/java/org/hibernate/graph/internal/parse/GraphParser.java index 20c40fedc949..44b92f090af9 100644 --- a/hibernate-core/src/main/java/org/hibernate/graph/internal/parse/GraphParser.java +++ b/hibernate-core/src/main/java/org/hibernate/graph/internal/parse/GraphParser.java @@ -23,11 +23,12 @@ import org.antlr.v4.runtime.CharStreams; import org.antlr.v4.runtime.CommonTokenStream; +import static org.hibernate.graph.internal.GraphParserLogging.PARSING_LOGGER; + /** * @author Steve Ebersole */ public class GraphParser extends GraphLanguageParserBaseVisitor { - public static final Logger PARSING_LOGGER = Logger.getLogger( "org.hibernate.orm.graph.parsing" ); /** * Parse the passed graph textual representation into the passed Graph. diff --git a/hibernate-core/src/main/java/org/hibernate/id/factory/IdGenFactoryLogging.java b/hibernate-core/src/main/java/org/hibernate/id/factory/IdGenFactoryLogging.java index 04bbc9c03274..978fb5b2939a 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/factory/IdGenFactoryLogging.java +++ b/hibernate-core/src/main/java/org/hibernate/id/factory/IdGenFactoryLogging.java @@ -6,14 +6,21 @@ */ package org.hibernate.id.factory; +import org.hibernate.internal.log.SubSystemLogging; + import org.jboss.logging.Logger; /** * Logging related to IdentifierGeneratorFactory */ -public class IdGenFactoryLogging { - public static final Logger ID_GEN_FAC_LOGGER = Logger.getLogger( "org.hibernate.orm.idgen.factory" ); +@SubSystemLogging( + name = IdGenFactoryLogging.LOGGER_NAME, + description = "Logging related to creation of IdentifierGenerator instances" +) +public interface IdGenFactoryLogging { + String LOGGER_NAME = SubSystemLogging.BASE + ".idgen.factory"; + Logger ID_GEN_FAC_LOGGER = Logger.getLogger( LOGGER_NAME ); - public static final boolean IS_TRACE_ENABLE = ID_GEN_FAC_LOGGER.isTraceEnabled(); - public static final boolean IS_DEBUG_ENABLE = ID_GEN_FAC_LOGGER.isDebugEnabled(); + boolean IS_TRACE_ENABLE = ID_GEN_FAC_LOGGER.isTraceEnabled(); + boolean IS_DEBUG_ENABLE = ID_GEN_FAC_LOGGER.isDebugEnabled(); } diff --git a/hibernate-core/src/main/java/org/hibernate/id/factory/internal/StandardIdentifierGeneratorFactory.java b/hibernate-core/src/main/java/org/hibernate/id/factory/internal/StandardIdentifierGeneratorFactory.java index 4d077def792e..b68415430725 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/factory/internal/StandardIdentifierGeneratorFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/id/factory/internal/StandardIdentifierGeneratorFactory.java @@ -11,6 +11,7 @@ import java.util.Map; import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; +import jakarta.persistence.GenerationType; import org.hibernate.MappingException; import org.hibernate.NotYetImplementedFor6Exception; @@ -20,7 +21,6 @@ import org.hibernate.cfg.AvailableSettings; import org.hibernate.dialect.Dialect; import org.hibernate.engine.config.spi.ConfigurationService; -import org.hibernate.engine.config.spi.StandardConverters; import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; import org.hibernate.id.Assigned; import org.hibernate.id.ForeignGenerator; @@ -33,7 +33,6 @@ import org.hibernate.id.UUIDHexGenerator; import org.hibernate.id.enhanced.SequenceStyleGenerator; import org.hibernate.id.enhanced.TableGenerator; -import org.hibernate.id.factory.IdGenFactoryLogging; import org.hibernate.id.factory.IdentifierGeneratorFactory; import org.hibernate.id.factory.spi.GenerationTypeStrategy; import org.hibernate.id.factory.spi.GenerationTypeStrategyRegistration; @@ -43,7 +42,6 @@ import org.hibernate.jpa.spi.IdentifierGeneratorStrategyProvider; import org.hibernate.resource.beans.container.spi.BeanContainer; import org.hibernate.resource.beans.container.spi.ContainedBean; -import org.hibernate.resource.beans.container.spi.ExtendedBeanManager; import org.hibernate.resource.beans.internal.FallbackBeanInstanceProducer; import org.hibernate.resource.beans.internal.Helper; import org.hibernate.resource.beans.spi.ManagedBeanRegistry; @@ -51,8 +49,6 @@ import org.hibernate.type.Type; import org.hibernate.type.descriptor.java.JavaType; -import jakarta.persistence.GenerationType; - import static org.hibernate.id.factory.IdGenFactoryLogging.ID_GEN_FAC_LOGGER; /** @@ -112,7 +108,7 @@ public StandardIdentifierGeneratorFactory(ServiceRegistry serviceRegistry, boole generationTypeStrategy ); if ( previous != null ) { - IdGenFactoryLogging.ID_GEN_FAC_LOGGER.debugf( + ID_GEN_FAC_LOGGER.debugf( "GenerationTypeStrategyRegistration [%s] overrode previous registration for GenerationType#%s : %s", registration, generationType.name(), diff --git a/hibernate-core/src/main/java/org/hibernate/internal/CoreLogging.java b/hibernate-core/src/main/java/org/hibernate/internal/CoreLogging.java index 3db3ccbf2216..961b36b55d5f 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/CoreLogging.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/CoreLogging.java @@ -14,9 +14,6 @@ * @author Steve Ebersole */ public class CoreLogging { - public static String subsystemLoggerName(String subsystem) { - return "org.hibernate.orm." + subsystem; - } /** * Disallow instantiation diff --git a/hibernate-core/src/main/java/org/hibernate/internal/EntityManagerMessageLogger.java b/hibernate-core/src/main/java/org/hibernate/internal/EntityManagerMessageLogger.java index c75c66f78c9c..adf2ffccd41a 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/EntityManagerMessageLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/EntityManagerMessageLogger.java @@ -13,6 +13,7 @@ import org.jboss.logging.annotations.LogMessage; import org.jboss.logging.annotations.Message; import org.jboss.logging.annotations.MessageLogger; +import org.jboss.logging.annotations.ValidIdRange; import static org.jboss.logging.Logger.Level.DEBUG; import static org.jboss.logging.Logger.Level.ERROR; @@ -20,12 +21,10 @@ import static org.jboss.logging.Logger.Level.WARN; /** - * The jboss-logging {@link MessageLogger} for the hibernate-entitymanager module. It reserves message ids ranging from - * 15001 to 20000 inclusively. - *

- * New messages must be added after the last message defined to ensure message codes are unique. + * {@link MessageLogger} originally for the no-longer existing hibernate-entitymanager module. */ @MessageLogger(projectCode = "HHH") +@ValidIdRange( min = 15001, max = 20000 ) public interface EntityManagerMessageLogger extends CoreMessageLogger { @LogMessage(level = INFO) diff --git a/hibernate-core/src/main/java/org/hibernate/internal/log/ConnectionAccessLogger.java b/hibernate-core/src/main/java/org/hibernate/internal/log/ConnectionAccessLogger.java index a8f9c0dddabf..8372646e8f7c 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/log/ConnectionAccessLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/log/ConnectionAccessLogger.java @@ -22,8 +22,12 @@ */ @MessageLogger( projectCode = "HHH" ) @ValidIdRange( min = 10001501, max = 10002000 ) +@SubSystemLogging( + name = ConnectionAccessLogger.LOGGER_NAME, + description = "Used to log details around use of `JdbcConnectionAccess`" +) public interface ConnectionAccessLogger extends BasicLogger { - String LOGGER_NAME = "org.hibernate.orm.connections.access"; + String LOGGER_NAME = SubSystemLogging.BASE + ".connections.access"; /** * Static access to the logging instance diff --git a/hibernate-core/src/main/java/org/hibernate/internal/log/ConnectionPoolingLogger.java b/hibernate-core/src/main/java/org/hibernate/internal/log/ConnectionPoolingLogger.java index bf82184a42a0..2e5835724506 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/log/ConnectionPoolingLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/log/ConnectionPoolingLogger.java @@ -26,8 +26,12 @@ */ @MessageLogger( projectCode = "HHH" ) @ValidIdRange( min = 10001001, max = 10001500 ) +@SubSystemLogging( + name = ConnectionPoolingLogger.LOGGER_NAME, + description = "Logging related to connection pooling" +) public interface ConnectionPoolingLogger extends BasicLogger { - String LOGGER_NAME = "org.hibernate.orm.connections.pooling"; + String LOGGER_NAME = SubSystemLogging.BASE + ".connections.pooling"; /** * Static access to the logging instance diff --git a/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java b/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java index 74cc1189932c..a5570df4c058 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java @@ -13,7 +13,6 @@ import org.jboss.logging.annotations.MessageLogger; import org.jboss.logging.annotations.ValidIdRange; -import static org.jboss.logging.Logger.Level.INFO; import static org.jboss.logging.Logger.Level.WARN; /** @@ -23,13 +22,14 @@ */ @MessageLogger( projectCode = "HHH" ) @ValidIdRange( min = 90000001, max = 90001000 ) +@SubSystemLogging( + name = DeprecationLogger.CATEGORY, + description = "Logging related to uses of deprecated features" +) public interface DeprecationLogger extends BasicLogger { - String CATEGORY = "org.hibernate.orm.deprecation"; + String CATEGORY = SubSystemLogging.BASE + ".deprecation"; - DeprecationLogger DEPRECATION_LOGGER = Logger.getMessageLogger( - DeprecationLogger.class, - CATEGORY - ); + DeprecationLogger DEPRECATION_LOGGER = Logger.getMessageLogger( DeprecationLogger.class, CATEGORY ); @LogMessage(level = WARN) @Message( diff --git a/hibernate-core/src/main/java/org/hibernate/internal/log/SubSystemLogging.java b/hibernate-core/src/main/java/org/hibernate/internal/log/SubSystemLogging.java new file mode 100644 index 000000000000..5771adcada0d --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/internal/log/SubSystemLogging.java @@ -0,0 +1,53 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later + * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html + */ +package org.hibernate.internal.log; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Used to annotate classes which define sub-system style logging where + * loggers are hierarchically defined around functionalities rather than + * class and package names + *

+ * This is helpful to find such classes and is used to generate report + * (as a release artifact) describing logger names for logging configuration + * by the application. + *

+ * At the moment Hibernate uses a mix sub-system logging and the more traditional + * package and class name based logging. This annotation focuses on the classes + * defining the sub-system approach + * + * @author Steve Ebersole + */ +@Target(TYPE) +@Retention(RUNTIME) +public @interface SubSystemLogging { + /** + * Base category name for sub-system style logging + */ + String BASE = "org.hibernate.orm"; + + /** + * The sub-system name, which is used as the "logger name" + */ + String name(); + + /** + * Description of the information logged + */ + String description(); + + /** + * Aside from test usage, is the associated logger always used + * through the sub-system category name? + */ + boolean mixed() default false; +} diff --git a/hibernate-core/src/main/java/org/hibernate/internal/log/UnsupportedLogger.java b/hibernate-core/src/main/java/org/hibernate/internal/log/UnsupportedLogger.java deleted file mode 100644 index 87af6645f506..000000000000 --- a/hibernate-core/src/main/java/org/hibernate/internal/log/UnsupportedLogger.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.internal.log; - -import org.hibernate.cfg.AvailableSettings; - -import org.jboss.logging.annotations.LogMessage; -import org.jboss.logging.annotations.Message; -import org.jboss.logging.annotations.MessageLogger; -import org.jboss.logging.annotations.ValidIdRange; - -import static org.jboss.logging.Logger.Level.WARN; - -/** - * Class to consolidate logging about usage of features which should - * never be used. - * Such features might have been introduced for practical reasons so - * that people who really know what they want can use them, with the - * understanding that they should find a better alternative. - * - * @author Sanne Grinovero - */ -@MessageLogger( projectCode = "HHH" ) -@ValidIdRange( min = 90002001, max = 90003000 ) -public interface UnsupportedLogger { - -} diff --git a/hibernate-core/src/main/java/org/hibernate/internal/log/UrlMessageBundle.java b/hibernate-core/src/main/java/org/hibernate/internal/log/UrlMessageBundle.java index 944aaa683300..5e7208bcadb7 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/log/UrlMessageBundle.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/log/UrlMessageBundle.java @@ -27,8 +27,12 @@ */ @MessageLogger( projectCode = "HHH" ) @ValidIdRange( min = 10000001, max = 10001000 ) +@SubSystemLogging( + name = UrlMessageBundle.LOGGER_NAME, + description = "Logging related to URL handling" +) public interface UrlMessageBundle { - String LOGGER_NAME = "org.hibernate.orm.url"; + String LOGGER_NAME = SubSystemLogging.BASE + ".url"; Logger URL_LOGGER = Logger.getLogger( LOGGER_NAME ); UrlMessageBundle URL_MESSAGE_LOGGER = Logger.getMessageLogger( UrlMessageBundle.class, LOGGER_NAME ); diff --git a/hibernate-core/src/main/java/org/hibernate/loader/LoaderLogging.java b/hibernate-core/src/main/java/org/hibernate/loader/LoaderLogging.java index 80c46124b0fb..8a30cc9b48eb 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/LoaderLogging.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/LoaderLogging.java @@ -6,13 +6,24 @@ */ package org.hibernate.loader; +import org.hibernate.internal.log.SubSystemLogging; + import org.jboss.logging.Logger; /** * Logging for loaders + * + * @see org.hibernate.loader.ast.spi.Loader + * + * @author Steve Ebersole */ +@SubSystemLogging( + name = LoaderLogging.LOGGER_NAME, + description = "Logging related to loaders of domain model references (`org.hibernate.loader.ast.spi.Loader`); " + + "see also `" + SubSystemLogging.BASE + ".results`" +) public interface LoaderLogging { - String LOGGER_NAME = "org.hibernate.orm.loader"; + String LOGGER_NAME = SubSystemLogging.BASE + ".loader"; Logger LOADER_LOGGER = Logger.getLogger( LOGGER_NAME ); diff --git a/hibernate-core/src/main/java/org/hibernate/loader/ast/LoaderLogging.java b/hibernate-core/src/main/java/org/hibernate/loader/ast/LoaderLogging.java deleted file mode 100644 index f751e5d62562..000000000000 --- a/hibernate-core/src/main/java/org/hibernate/loader/ast/LoaderLogging.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later - * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html - */ -package org.hibernate.loader.ast; - -import org.jboss.logging.Logger; - -/** - * Logging for loaders - */ -public interface LoaderLogging { - String LOGGER_NAME = "org.hibernate.orm.loader"; - - Logger LOADER_LOGGER = Logger.getLogger( LOGGER_NAME ); - - boolean DEBUG_ENABLED = LOADER_LOGGER.isDebugEnabled(); - boolean TRACE_ENABLED = LOADER_LOGGER.isTraceEnabled(); -} diff --git a/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/LoaderHelper.java b/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/LoaderHelper.java index 9679ab7ec1a8..cce346121a81 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/LoaderHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/ast/internal/LoaderHelper.java @@ -14,7 +14,7 @@ import org.hibernate.engine.spi.EntityEntry; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.Status; -import org.hibernate.loader.ast.LoaderLogging; +import org.hibernate.loader.LoaderLogging; import org.hibernate.persister.entity.EntityPersister; /** diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/CollectionClassification.java b/hibernate-core/src/main/java/org/hibernate/metamodel/CollectionClassification.java index 04dd38809acd..700c73b83475 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/CollectionClassification.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/CollectionClassification.java @@ -155,7 +155,7 @@ public static CollectionClassification interpretSetting(Object value) { return BAG; } - BootLogging.LOGGER.debugf( + BootLogging.BOOT_LOGGER.debugf( "Unexpected Class specified for CollectionClassification resolution (`%s`) - " + "should be one of `%s`, `%s`, `%s`, `%s`, `%s` or `%s` (or subclass of)", configuredClass.getName(), diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/MappingModelCreationLogger.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/MappingModelCreationLogger.java index fc7d6f7fdbd5..a668fd3aeed3 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/MappingModelCreationLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/MappingModelCreationLogger.java @@ -6,6 +6,8 @@ */ package org.hibernate.metamodel.mapping; +import org.hibernate.internal.log.SubSystemLogging; + import org.jboss.logging.BasicLogger; import org.jboss.logging.Logger; import org.jboss.logging.annotations.MessageLogger; @@ -18,8 +20,12 @@ */ @MessageLogger( projectCode = "HHH" ) @ValidIdRange( min = 90005701, max = 90005800 ) +@SubSystemLogging( + name = MappingModelCreationLogger.LOGGER_NAME, + description = "Logging related to building of Hibernate's runtime metamodel descriptors of the domain model" +) public interface MappingModelCreationLogger extends BasicLogger { - String LOGGER_NAME = "org.hibernate.orm.model.mapping.creation"; + String LOGGER_NAME = SubSystemLogging.BASE + ".model.mapping.creation"; MappingModelCreationLogger LOGGER = Logger.getMessageLogger( MappingModelCreationLogger.class, LOGGER_NAME ); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/NaturalIdLogging.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/NaturalIdLogging.java index 71f20926ec64..2ac16c70dbdd 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/NaturalIdLogging.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/NaturalIdLogging.java @@ -6,7 +6,7 @@ */ package org.hibernate.metamodel.mapping; -import org.hibernate.internal.CoreLogging; +import org.hibernate.internal.log.SubSystemLogging; import org.jboss.logging.Logger; @@ -15,10 +15,14 @@ * * @author Steve Ebersole */ +@SubSystemLogging( + name = NaturalIdLogging.LOGGER_NAME, + description = "Logging related to handling of natural-id mappings" +) public interface NaturalIdLogging { - String LOGGER_NAME = CoreLogging.subsystemLoggerName( "mapping.natural_id" ); - Logger LOGGER = Logger.getLogger( LOGGER_NAME ); + String LOGGER_NAME = SubSystemLogging.BASE + ".mapping.natural_id"; + Logger NATURAL_ID_LOGGER = Logger.getLogger( LOGGER_NAME ); - boolean DEBUG_ENABLED = LOGGER.isDebugEnabled(); - boolean TRACE_ENABLED = LOGGER.isTraceEnabled(); + boolean DEBUG_ENABLED = NATURAL_ID_LOGGER.isDebugEnabled(); + boolean TRACE_ENABLED = NATURAL_ID_LOGGER.isTraceEnabled(); } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/BasicValuedCollectionPart.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/BasicValuedCollectionPart.java index cbc82503a2d4..55a481430ddc 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/BasicValuedCollectionPart.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/BasicValuedCollectionPart.java @@ -249,7 +249,7 @@ public Fetch generateFetch( boolean selected, String resultVariable, DomainResultCreationState creationState) { - ResultsLogger.LOGGER.debugf( + ResultsLogger.RESULTS_LOGGER.debugf( "Generating Fetch for collection-part : `%s` -> `%s`", collectionDescriptor.getRole(), nature.getName() diff --git a/hibernate-core/src/main/java/org/hibernate/query/QueryLogging.java b/hibernate-core/src/main/java/org/hibernate/query/QueryLogging.java index 99ee0870c7a7..701377602043 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/QueryLogging.java +++ b/hibernate-core/src/main/java/org/hibernate/query/QueryLogging.java @@ -7,6 +7,7 @@ package org.hibernate.query; import org.hibernate.HibernateException; +import org.hibernate.internal.log.SubSystemLogging; import org.jboss.logging.BasicLogger; import org.jboss.logging.Logger; @@ -25,8 +26,12 @@ */ @MessageLogger( projectCode = "HHH" ) @ValidIdRange( min = 90003001, max = 90003500 ) +@SubSystemLogging( + name = QueryLogging.LOGGER_NAME, + description = "Logging related to Query processing" +) public interface QueryLogging extends BasicLogger { - String LOGGER_NAME = "org.hibernate.orm.query"; + String LOGGER_NAME = SubSystemLogging.BASE + ".query"; Logger QUERY_LOGGER = Logger.getLogger( LOGGER_NAME ); QueryLogging QUERY_MESSAGE_LOGGER = Logger.getMessageLogger( QueryLogging.class, LOGGER_NAME ); diff --git a/hibernate-core/src/main/java/org/hibernate/query/hql/HqlLogging.java b/hibernate-core/src/main/java/org/hibernate/query/hql/HqlLogging.java index f540f8c6a2a1..93b10601bffa 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/hql/HqlLogging.java +++ b/hibernate-core/src/main/java/org/hibernate/query/hql/HqlLogging.java @@ -7,6 +7,7 @@ package org.hibernate.query.hql; import org.hibernate.HibernateException; +import org.hibernate.internal.log.SubSystemLogging; import org.hibernate.query.QueryLogging; import org.jboss.logging.BasicLogger; @@ -24,8 +25,12 @@ */ @MessageLogger( projectCode = "HHH" ) @ValidIdRange( min = 90003501, max = 90004000 ) +@SubSystemLogging( + name = HqlLogging.LOGGER_NAME, + description = "Logging related to HQL parsing" +) public interface HqlLogging extends BasicLogger { - String LOGGER_NAME = QueryLogging.subLoggerName( "hql" ); + String LOGGER_NAME = QueryLogging.LOGGER_NAME + ".hql"; HqlLogging QUERY_LOGGER = Logger.getMessageLogger( HqlLogging.class, LOGGER_NAME ); diff --git a/hibernate-core/src/main/java/org/hibernate/query/results/DomainResultCreationStateImpl.java b/hibernate-core/src/main/java/org/hibernate/query/results/DomainResultCreationStateImpl.java index 3dba790bf7a5..93135837dedd 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/results/DomainResultCreationStateImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/query/results/DomainResultCreationStateImpl.java @@ -118,7 +118,7 @@ public boolean arePositionalSelectionsAllowed() { } public void disallowPositionalSelections() { - ResultsLogger.LOGGER.debugf( "Disallowing positional selections : %s", stateIdentifier ); + ResultsLogger.RESULTS_LOGGER.debugf( "Disallowing positional selections : %s", stateIdentifier ); this.allowPositionalSelections = false; } diff --git a/hibernate-core/src/main/java/org/hibernate/resource/beans/container/spi/AbstractCdiBeanContainer.java b/hibernate-core/src/main/java/org/hibernate/resource/beans/container/spi/AbstractCdiBeanContainer.java index 572c46ad9b62..bb74b57df932 100644 --- a/hibernate-core/src/main/java/org/hibernate/resource/beans/container/spi/AbstractCdiBeanContainer.java +++ b/hibernate-core/src/main/java/org/hibernate/resource/beans/container/spi/AbstractCdiBeanContainer.java @@ -140,7 +140,7 @@ protected final void forEachBean(Consumer> consumer) @Override public final void stop() { - BeansMessageLogger.BEANS_MESSAGE_LOGGER.stoppingBeanContainer( this ); + BeansMessageLogger.BEANS_MSG_LOGGER.stoppingBeanContainer( this ); forEachBean( ContainedBeanImplementor::release ); registeredBeans.clear(); beanCache.clear(); diff --git a/hibernate-core/src/main/java/org/hibernate/resource/beans/internal/BeansMessageLogger.java b/hibernate-core/src/main/java/org/hibernate/resource/beans/internal/BeansMessageLogger.java index f1f57abb2661..a62ad2b2afd8 100644 --- a/hibernate-core/src/main/java/org/hibernate/resource/beans/internal/BeansMessageLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/resource/beans/internal/BeansMessageLogger.java @@ -6,6 +6,7 @@ */ package org.hibernate.resource.beans.internal; +import org.hibernate.internal.log.SubSystemLogging; import org.hibernate.resource.beans.container.spi.BeanContainer; import org.hibernate.resource.beans.spi.ManagedBeanRegistry; @@ -23,14 +24,15 @@ */ @MessageLogger( projectCode = "HHH" ) @ValidIdRange( min = 10005001, max = 10010000 ) +@SubSystemLogging( + name = BeansMessageLogger.LOGGER_NAME, + description = "Logging related to Hibernate's support for managed beans (CDI, etc)" +) public interface BeansMessageLogger { - String LOGGER_NAME = "org.hibernate.orm.beans"; + String LOGGER_NAME = SubSystemLogging.BASE + ".beans"; - /** - * The BeansMessageLogger instance - */ Logger BEANS_LOGGER = Logger.getLogger( LOGGER_NAME ); - BeansMessageLogger BEANS_MESSAGE_LOGGER = Logger.getMessageLogger( BeansMessageLogger.class, LOGGER_NAME ); + BeansMessageLogger BEANS_MSG_LOGGER = Logger.getMessageLogger( BeansMessageLogger.class, LOGGER_NAME ); @LogMessage( level = WARN ) @Message( diff --git a/hibernate-core/src/main/java/org/hibernate/resource/beans/spi/ManagedBeanRegistryInitiator.java b/hibernate-core/src/main/java/org/hibernate/resource/beans/spi/ManagedBeanRegistryInitiator.java index 56be3721571a..1ee8c44259ea 100644 --- a/hibernate-core/src/main/java/org/hibernate/resource/beans/spi/ManagedBeanRegistryInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/resource/beans/spi/ManagedBeanRegistryInitiator.java @@ -66,14 +66,14 @@ private BeanContainer resolveBeanContainer(Map configurationValues, Service } if ( beanManagerRef != null ) { if ( !isCdiAvailable ) { - BeansMessageLogger.BEANS_MESSAGE_LOGGER.beanManagerButCdiNotAvailable( beanManagerRef ); + BeansMessageLogger.BEANS_MSG_LOGGER.beanManagerButCdiNotAvailable( beanManagerRef ); } return CdiBeanContainerBuilder.fromBeanManagerReference( beanManagerRef, serviceRegistry ); } else { if ( isCdiAvailable ) { - BeansMessageLogger.BEANS_MESSAGE_LOGGER.noBeanManagerButCdiAvailable(); + BeansMessageLogger.BEANS_MSG_LOGGER.noBeanManagerButCdiAvailable(); } } diff --git a/hibernate-core/src/main/java/org/hibernate/sql/ast/SqlTreeCreationLogger.java b/hibernate-core/src/main/java/org/hibernate/sql/ast/SqlTreeCreationLogger.java index 99bf27378bd9..29c7ab8a0467 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/ast/SqlTreeCreationLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/ast/SqlTreeCreationLogger.java @@ -6,13 +6,19 @@ */ package org.hibernate.sql.ast; +import org.hibernate.internal.log.SubSystemLogging; + import org.jboss.logging.Logger; /** * @author Steve Ebersole */ +@SubSystemLogging( + name = SqlTreeCreationLogger.LOGGER_NAME, + description = "Logging related to the creation of SQL AST trees" +) public interface SqlTreeCreationLogger { - String LOGGER_NAME = "org.hibernate.orm.sql.ast.create"; + String LOGGER_NAME = SubSystemLogging.BASE + ".sql.ast.create"; Logger LOGGER = Logger.getLogger( LOGGER_NAME ); diff --git a/hibernate-core/src/main/java/org/hibernate/sql/ast/tree/SqlAstTreeLogger.java b/hibernate-core/src/main/java/org/hibernate/sql/ast/tree/SqlAstTreeLogger.java index 98844abfa457..e82033534408 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/ast/tree/SqlAstTreeLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/ast/tree/SqlAstTreeLogger.java @@ -6,6 +6,9 @@ */ package org.hibernate.sql.ast.tree; +import org.hibernate.internal.log.SubSystemLogging; +import org.hibernate.sql.ast.SqlTreeCreationLogger; + import org.jboss.logging.BasicLogger; import org.jboss.logging.Logger; import org.jboss.logging.annotations.MessageLogger; @@ -18,8 +21,12 @@ */ @MessageLogger( projectCode = "HHH" ) @ValidIdRange( min = 90005401, max = 90005500 ) +@SubSystemLogging( + name = SqlAstTreeLogger.LOGGER_NAME, + description = "Logging related to the processing of SQL AST trees" +) public interface SqlAstTreeLogger extends BasicLogger { - String LOGGER_NAME = "org.hibernate.orm.sql.ast.tree"; + String LOGGER_NAME = SubSystemLogging.BASE + ".sql.ast.tree"; /** * Static access to the logging instance diff --git a/hibernate-core/src/main/java/org/hibernate/sql/exec/SqlExecLogger.java b/hibernate-core/src/main/java/org/hibernate/sql/exec/SqlExecLogger.java index ae4cceb36570..4652fdfb5091 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/exec/SqlExecLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/exec/SqlExecLogger.java @@ -6,6 +6,8 @@ */ package org.hibernate.sql.exec; +import org.hibernate.internal.log.SubSystemLogging; + import org.jboss.logging.BasicLogger; import org.jboss.logging.Logger; import org.jboss.logging.annotations.MessageLogger; @@ -16,16 +18,12 @@ */ @MessageLogger( projectCode = "HHH" ) @ValidIdRange( min = 90004001, max = 90005000 ) +@SubSystemLogging( + name = SqlExecLogger.LOGGER_NAME, + description = "Logging related to the execution of SQL statements" +) public interface SqlExecLogger extends BasicLogger { - String LOGGER_NAME = "org.hibernate.orm.sql.exec"; - - /** - * Static access to the logging instance - */ - SqlExecLogger INSTANCE = Logger.getMessageLogger( - SqlExecLogger.class, - LOGGER_NAME - ); + String LOGGER_NAME = SubSystemLogging.BASE + ".sql.exec"; - // todo (6.0) : make sure sql execution classes use this logger + SqlExecLogger SQL_EXEC_LOGGER = Logger.getMessageLogger( SqlExecLogger.class, LOGGER_NAME ); } diff --git a/hibernate-core/src/main/java/org/hibernate/sql/exec/internal/JdbcSelectExecutorStandardImpl.java b/hibernate-core/src/main/java/org/hibernate/sql/exec/internal/JdbcSelectExecutorStandardImpl.java index c81779a6088c..ab12d9c71bea 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/exec/internal/JdbcSelectExecutorStandardImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/exec/internal/JdbcSelectExecutorStandardImpl.java @@ -474,13 +474,13 @@ private JdbcValues resolveJdbcValuesSource( final QueryKey queryResultsCacheKey; if ( cacheable && cacheMode.isGetEnabled() ) { - SqlExecLogger.INSTANCE.debugf( "Reading Query result cache data per CacheMode#isGetEnabled [%s]", cacheMode.name() ); + SqlExecLogger.SQL_EXEC_LOGGER.debugf( "Reading Query result cache data per CacheMode#isGetEnabled [%s]", cacheMode.name() ); final Set querySpaces = jdbcSelect.getAffectedTableNames(); if ( querySpaces == null || querySpaces.size() == 0 ) { - SqlExecLogger.INSTANCE.tracef( "Unexpected querySpaces is empty" ); + SqlExecLogger.SQL_EXEC_LOGGER.tracef( "Unexpected querySpaces is empty" ); } else { - SqlExecLogger.INSTANCE.tracef( "querySpaces is `%s`", querySpaces ); + SqlExecLogger.SQL_EXEC_LOGGER.tracef( "querySpaces is `%s`", querySpaces ); } final QueryResultsCache queryCache = factory.getCache() @@ -520,7 +520,7 @@ private JdbcValues resolveJdbcValuesSource( } } else { - SqlExecLogger.INSTANCE.debugf( "Skipping reading Query result cache data: cache-enabled = %s, cache-mode = %s", + SqlExecLogger.SQL_EXEC_LOGGER.debugf( "Skipping reading Query result cache data: cache-enabled = %s, cache-mode = %s", queryCacheEnabled, cacheMode.name() ); diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/LoadingLogger.java b/hibernate-core/src/main/java/org/hibernate/sql/results/LoadingLogger.java index f401de150611..859eba7d550d 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/LoadingLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/LoadingLogger.java @@ -6,6 +6,8 @@ */ package org.hibernate.sql.results; +import org.hibernate.internal.log.SubSystemLogging; + import org.jboss.logging.BasicLogger; import org.jboss.logging.Logger; import org.jboss.logging.annotations.MessageLogger; @@ -16,8 +18,12 @@ */ @MessageLogger( projectCode = "HHH" ) @ValidIdRange( min = 90005801, max = 90005900 ) +@SubSystemLogging( + name = LoadingLogger.LOGGER_NAME, + description = "Logging related to building parts of the domain model from JDBC or from cache" +) public interface LoadingLogger extends BasicLogger { - String LOGGER_NAME = ResultsLogger.subLoggerName( "loading" ); + String LOGGER_NAME = ResultsLogger.LOGGER_NAME + ".loading"; Logger LOGGER = Logger.getLogger( LOGGER_NAME ); LoadingLogger MESSAGE_LOGGER = Logger.getMessageLogger( LoadingLogger.class, LOGGER_NAME ); diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/ResultsLogger.java b/hibernate-core/src/main/java/org/hibernate/sql/results/ResultsLogger.java index be7b64023739..80067f1a5cb4 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/ResultsLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/ResultsLogger.java @@ -6,6 +6,8 @@ */ package org.hibernate.sql.results; +import org.hibernate.internal.log.SubSystemLogging; + import org.jboss.logging.BasicLogger; import org.jboss.logging.Logger; import org.jboss.logging.annotations.MessageLogger; @@ -18,22 +20,26 @@ * * * creation of the DomainResult / Fetch nodes * * creation of Initializer / DomainResultAssembler delegates - * * processing of JDBC values via Initializer / DomainResultAssembler + * * processing of values from JDBC and cache via Initializer / DomainResultAssembler * * @author Steve Ebersole */ @MessageLogger( projectCode = "HHH" ) @ValidIdRange( min = 90005001, max = 90005100 ) +@SubSystemLogging( + name = ResultsLogger.LOGGER_NAME, + description = "Logging related to `DomainResult` graphs which build individual parts of the domain model from JDBC or from cache" +) public interface ResultsLogger extends BasicLogger { - String LOGGER_NAME = "org.hibernate.orm.sql.results"; + String LOGGER_NAME = SubSystemLogging.BASE + ".results"; + + Logger RESULTS_LOGGER = Logger.getLogger( LOGGER_NAME ); + ResultsLogger RESULTS_MESSAGE_LOGGER = Logger.getMessageLogger( ResultsLogger.class, LOGGER_NAME ); + + // todo (6.0) : make sure sql result processing classes use this logger - /** - * Static access to the logging instance - */ - ResultsLogger LOGGER = Logger.getMessageLogger( - ResultsLogger.class, - LOGGER_NAME - ); + boolean TRACE_ENABLED = RESULTS_LOGGER.isTraceEnabled(); + boolean DEBUG_ENABLED = RESULTS_LOGGER.isDebugEnabled(); static String subLoggerName(String subName) { return LOGGER_NAME + "." + subName; @@ -43,9 +49,4 @@ static Logger subLogger(String subName) { return Logger.getLogger( subLoggerName( subName ) ); } - // todo (6.0) : make sure sql result processing classes use this logger - - boolean TRACE_ENABLED = LOGGER.isTraceEnabled(); - boolean DEBUG_ENABLED = LOGGER.isDebugEnabled(); - boolean INFO_ENABLED = LOGGER.isInfoEnabled(); } diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/AssemblerLogger.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/AssemblerLogger.java deleted file mode 100644 index f4cf3a07bcf1..000000000000 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/AssemblerLogger.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later - * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html - */ -package org.hibernate.sql.results.graph; - -import org.hibernate.sql.results.ResultsLogger; - -import org.jboss.logging.Logger; - -/** - * @author Steve Ebersole - */ -public interface AssemblerLogger { - Logger LOGGER = ResultsLogger.subLogger( "assembler" ); - - boolean DEBUG_ENABLED = LOGGER.isDebugEnabled(); - boolean TRACE_ENABLED = LOGGER.isTraceEnabled(); -} diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/DomainResultGraphPrinter.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/DomainResultGraphPrinter.java index 94e21de4191a..6129b5563eff 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/DomainResultGraphPrinter.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/DomainResultGraphPrinter.java @@ -8,30 +8,39 @@ import java.util.List; +import org.hibernate.internal.log.SubSystemLogging; import org.hibernate.internal.util.collections.Stack; import org.hibernate.internal.util.collections.StandardStack; import org.hibernate.sql.results.ResultsLogger; import org.jboss.logging.Logger; +import static org.hibernate.sql.results.graph.DomainResultGraphPrinter.Logging.AST_LOGGER; +import static org.hibernate.sql.results.graph.DomainResultGraphPrinter.Logging.TRACE_ENABLED; + /** * Printer for DomainResult graphs * - * todo (6.0) : implement / use this - * * @author Steve Ebersole */ public class DomainResultGraphPrinter { - private static final Logger log = ResultsLogger.subLogger( "graph.AST" ); - private static final boolean DEBUG_ENABLED = log.isDebugEnabled(); - private static final boolean TRACE_ENABLED = log.isTraceEnabled(); + @SubSystemLogging( + name = Logging.LOGGER_NAME, + description = "Logging of `DomainResult` graphs" + ) + interface Logging { + String LOGGER_NAME = ResultsLogger.LOGGER_NAME + ".graph.AST"; + Logger AST_LOGGER = Logger.getLogger( LOGGER_NAME ); + boolean DEBUG_ENABLED = AST_LOGGER.isDebugEnabled(); + boolean TRACE_ENABLED = AST_LOGGER.isTraceEnabled(); + } public static void logDomainResultGraph(List> domainResults) { logDomainResultGraph( "DomainResult Graph", domainResults ); } public static void logDomainResultGraph(String header, List> domainResults) { - if ( ! DEBUG_ENABLED ) { + if ( ! Logging.DEBUG_ENABLED ) { return; } @@ -57,10 +66,10 @@ private void visitDomainResults(List> domainResults) { visitGraphNode( domainResult, lastInBranch ); } - log.debug( buffer.toString() ); + AST_LOGGER.debug( buffer.toString() ); if ( TRACE_ENABLED ) { - log.tracef( new Exception(), "Stack trace calling DomainResultGraphPrinter" ); + AST_LOGGER.tracef( new Exception(), "Stack trace calling DomainResultGraphPrinter" ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/ResultGraphLogging.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/ResultGraphLogging.java deleted file mode 100644 index 56a2cc5da78e..000000000000 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/ResultGraphLogging.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later - * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html - */ -package org.hibernate.sql.results.graph; - -import org.hibernate.sql.results.ResultsLogger; - -import org.jboss.logging.Logger; - -/** - * @author Steve Ebersole - */ -public interface ResultGraphLogging { - Logger LOGGER = ResultsLogger.subLogger( "graph" ); - - boolean DEBUG_ENABLED = LOGGER.isDebugEnabled(); - boolean TRACE_ENABLED = LOGGER.isTraceEnabled(); -} diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/basic/BasicResultAssembler.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/basic/BasicResultAssembler.java index 9378611ca276..556a900eb659 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/basic/BasicResultAssembler.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/basic/BasicResultAssembler.java @@ -58,7 +58,7 @@ public J assemble( JdbcValuesSourceProcessingOptions options) { final Object jdbcValue = extractRawValue( rowProcessingState ); - ResultsLogger.LOGGER.debugf( "Extracted JDBC value [%d] - [%s]", valuesArrayPosition, jdbcValue ); + ResultsLogger.RESULTS_MESSAGE_LOGGER.debugf( "Extracted JDBC value [%d] - [%s]", valuesArrayPosition, jdbcValue ); if ( valueConverter != null ) { if ( jdbcValue != null ) { diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/collection/CollectionLoadingLogger.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/collection/CollectionLoadingLogger.java index 747d84f932fc..15990fc59577 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/collection/CollectionLoadingLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/collection/CollectionLoadingLogger.java @@ -6,6 +6,7 @@ */ package org.hibernate.sql.results.graph.collection; +import org.hibernate.internal.log.SubSystemLogging; import org.hibernate.sql.results.LoadingLogger; import org.jboss.logging.BasicLogger; @@ -14,15 +15,17 @@ /** * @author Steve Ebersole */ +@SubSystemLogging( + name = CollectionLoadingLogger.LOGGER_NAME, + description = "Logging related to collection loading" +) public interface CollectionLoadingLogger extends BasicLogger { - String LOCAL_NAME = "collection"; - - String LOGGER_NAME = LoadingLogger.subLoggerName( LOCAL_NAME ); + String LOGGER_NAME = LoadingLogger.LOGGER_NAME + ".collection"; /** * Static access to the logging instance */ - Logger COLL_LOAD_LOGGER = LoadingLogger.subLogger( LOCAL_NAME ); + Logger COLL_LOAD_LOGGER = LoadingLogger.subLogger( LOGGER_NAME ); boolean TRACE_ENABLED = COLL_LOAD_LOGGER.isTraceEnabled(); boolean DEBUG_ENABLED = COLL_LOAD_LOGGER.isDebugEnabled(); diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/embeddable/AbstractEmbeddableInitializer.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/embeddable/AbstractEmbeddableInitializer.java index 20fe462493fa..4f81562e54fe 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/embeddable/AbstractEmbeddableInitializer.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/embeddable/AbstractEmbeddableInitializer.java @@ -150,7 +150,7 @@ public void resolveInstance(RowProcessingState processingState) { @Override public void initializeInstance(RowProcessingState processingState) { - EmbeddableLoadingLogger.INSTANCE.debugf( "Initializing composite instance [%s]", navigablePath ); + EmbeddableLoadingLogger.EMBEDDED_LOAD_LOGGER.debugf( "Initializing composite instance [%s]", navigablePath ); if ( compositeInstance == NULL_MARKER ) { // we already know it is null @@ -245,7 +245,7 @@ private void prepareCompositeInstance(RowProcessingState processingState) { ); } - EmbeddableLoadingLogger.INSTANCE.debugf( + EmbeddableLoadingLogger.EMBEDDED_LOAD_LOGGER.debugf( "Created composite instance [%s]", navigablePath ); @@ -323,7 +323,7 @@ private Object createCompositeInstance( final Object instance = representationStrategy.getInstantiator().instantiate( this, sessionFactory ); stateInjected = true; - EmbeddableLoadingLogger.INSTANCE.debugf( "Created composite instance [%s] : %s", navigablePath, instance ); + EmbeddableLoadingLogger.EMBEDDED_LOAD_LOGGER.debugf( "Created composite instance [%s] : %s", navigablePath, instance ); return instance; } @@ -348,7 +348,7 @@ private void handleParentInjection(RowProcessingState processingState) { // we want to avoid injection for `NULL_MARKER` if ( compositeInstance == null || compositeInstance == NULL_MARKER ) { - EmbeddableLoadingLogger.INSTANCE.debugf( + EmbeddableLoadingLogger.EMBEDDED_LOAD_LOGGER.debugf( "Skipping parent injection for null embeddable [%s]", navigablePath ); @@ -363,14 +363,14 @@ private void handleParentInjection(RowProcessingState processingState) { final Object parent = determineParentInstance( processingState ); if ( parent == null ) { - EmbeddableLoadingLogger.INSTANCE.debugf( + EmbeddableLoadingLogger.EMBEDDED_LOAD_LOGGER.debugf( "Unable to determine parent for injection into embeddable [%s]", navigablePath ); return; } - EmbeddableLoadingLogger.INSTANCE.debugf( + EmbeddableLoadingLogger.EMBEDDED_LOAD_LOGGER.debugf( "Injecting parent into embeddable [%s] : `%s` -> `%s`", navigablePath, parent, diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/embeddable/EmbeddableLoadingLogger.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/embeddable/EmbeddableLoadingLogger.java index d74c27b8c62f..2b8189e8d121 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/embeddable/EmbeddableLoadingLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/embeddable/EmbeddableLoadingLogger.java @@ -6,6 +6,7 @@ */ package org.hibernate.sql.results.graph.embeddable; +import org.hibernate.internal.log.SubSystemLogging; import org.hibernate.sql.results.LoadingLogger; import org.jboss.logging.BasicLogger; @@ -18,17 +19,19 @@ */ @MessageLogger( projectCode = "HHH" ) @ValidIdRange( min = 90005301, max = 90005400 ) +@SubSystemLogging( + name = EmbeddableLoadingLogger.LOGGER_NAME, + description = "Logging related to embeddable loading" +) public interface EmbeddableLoadingLogger extends BasicLogger { - String LOCAL_NAME = "composite"; - - String LOGGER_NAME = LoadingLogger.subLoggerName( LOCAL_NAME ); + String LOGGER_NAME = LoadingLogger.LOGGER_NAME + ".embeddable"; /** * Static access to the logging instance */ - Logger INSTANCE = LoadingLogger.subLogger( LOCAL_NAME ); + Logger EMBEDDED_LOAD_LOGGER = LoadingLogger.subLogger( LOGGER_NAME ); - boolean TRACE_ENABLED = INSTANCE.isTraceEnabled(); - boolean DEBUG_ENABLED = INSTANCE.isDebugEnabled(); + boolean TRACE_ENABLED = EMBEDDED_LOAD_LOGGER.isTraceEnabled(); + boolean DEBUG_ENABLED = EMBEDDED_LOAD_LOGGER.isDebugEnabled(); } diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/EntityLoadingLogging.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/EntityLoadingLogging.java index 4fec363c29e5..765ac948f370 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/EntityLoadingLogging.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/EntityLoadingLogging.java @@ -6,17 +6,22 @@ */ package org.hibernate.sql.results.graph.entity; +import org.hibernate.internal.log.SubSystemLogging; import org.hibernate.sql.results.LoadingLogger; +import org.hibernate.sql.results.graph.embeddable.EmbeddableLoadingLogger; import org.jboss.logging.Logger; /** * @author Steve Ebersole */ +@SubSystemLogging( + name = EmbeddableLoadingLogger.LOGGER_NAME, + description = "Logging related to entity loading" +) public interface EntityLoadingLogging { - String LOCAL_NAME = "entity"; - String LOGGER_NAME = LoadingLogger.subLoggerName( LOCAL_NAME ); - Logger ENTITY_LOADING_LOGGER = LoadingLogger.subLogger( LOCAL_NAME ); + String LOGGER_NAME = LoadingLogger.LOGGER_NAME + ".entity"; + Logger ENTITY_LOADING_LOGGER = Logger.getLogger( LOGGER_NAME ); boolean TRACE_ENABLED = ENTITY_LOADING_LOGGER.isTraceEnabled(); boolean DEBUG_ENABLED = ENTITY_LOADING_LOGGER.isDebugEnabled(); diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/tuple/TupleResultAssembler.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/tuple/TupleResultAssembler.java index f56d60a15ebe..45a8160f4625 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/tuple/TupleResultAssembler.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/tuple/TupleResultAssembler.java @@ -44,9 +44,9 @@ public J assemble( JdbcValuesSourceProcessingOptions options) { final Object[] jdbcValues = extractRawValue( rowProcessingState ); - if ( ResultsLogger.LOGGER.isDebugEnabled() ) { + if ( ResultsLogger.RESULTS_MESSAGE_LOGGER.isDebugEnabled() ) { for ( int i = 0; i < valuesArrayPositions.length; i++ ) { - ResultsLogger.LOGGER.debugf( + ResultsLogger.RESULTS_MESSAGE_LOGGER.debugf( "Extracted JDBC value [%d] - [%s]", valuesArrayPositions[i], jdbcValues[i] diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/internal/ResultsHelper.java b/hibernate-core/src/main/java/org/hibernate/sql/results/internal/ResultsHelper.java index f7cfe35b5349..d5292685c0c8 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/internal/ResultsHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/internal/ResultsHelper.java @@ -78,7 +78,7 @@ public Initializer resolveInitializer( if ( existing != null ) { if ( fetchedModelPart.getNavigableRole().equals( existing.getInitializedPart().getNavigableRole() ) ) { - ResultsLogger.LOGGER.tracef( + ResultsLogger.RESULTS_MESSAGE_LOGGER.tracef( "Returning previously-registered initializer : %s", existing ); @@ -87,7 +87,7 @@ public Initializer resolveInitializer( } final Initializer initializer = producer.get(); - ResultsLogger.LOGGER.tracef( + ResultsLogger.RESULTS_MESSAGE_LOGGER.tracef( "Registering initializer : %s", initializer ); @@ -115,9 +115,9 @@ private static void logInitializers(Map initializerM return; } - ResultsLogger.LOGGER.debug( "Initializer list" ); + ResultsLogger.RESULTS_MESSAGE_LOGGER.debug( "Initializer list" ); initializerMap.forEach( (navigablePath, initializer) -> { - ResultsLogger.LOGGER.debugf( + ResultsLogger.RESULTS_MESSAGE_LOGGER.debugf( " %s -> %s@%s (%s)", navigablePath.getFullPath(), initializer, diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/jdbc/internal/JdbcValuesCacheHit.java b/hibernate-core/src/main/java/org/hibernate/sql/results/jdbc/internal/JdbcValuesCacheHit.java index fd6b1fb338b3..f34614884a6a 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/jdbc/internal/JdbcValuesCacheHit.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/jdbc/internal/JdbcValuesCacheHit.java @@ -71,7 +71,7 @@ private static Object[][] extractData(List cachedResults) { @Override protected boolean processNext(RowProcessingState rowProcessingState) { - ResultsLogger.LOGGER.tracef( "JdbcValuesCacheHit#processNext : position = %i; numberOfRows = %i", position, numberOfRows ); + ResultsLogger.RESULTS_MESSAGE_LOGGER.tracef( "JdbcValuesCacheHit#processNext : position = %i; numberOfRows = %i", position, numberOfRows ); // NOTE : explicitly skipping limit handling because the cached state ought // already be the limited size since the cache key includes limits @@ -88,7 +88,7 @@ protected boolean processNext(RowProcessingState rowProcessingState) { @Override protected boolean processPrevious(RowProcessingState rowProcessingState) { - ResultsLogger.LOGGER.tracef( "JdbcValuesCacheHit#processPrevious : position = %i; numberOfRows = %i", position, numberOfRows ); + ResultsLogger.RESULTS_MESSAGE_LOGGER.tracef( "JdbcValuesCacheHit#processPrevious : position = %i; numberOfRows = %i", position, numberOfRows ); // NOTE : explicitly skipping limit handling because the cached state ought // already be the limited size since the cache key includes limits @@ -105,7 +105,7 @@ protected boolean processPrevious(RowProcessingState rowProcessingState) { @Override protected boolean processScroll(int numberOfRows, RowProcessingState rowProcessingState) { - ResultsLogger.LOGGER.tracef( "JdbcValuesCacheHit#processScroll(%i) : position = %i; numberOfRows = %i", numberOfRows, position, this.numberOfRows ); + ResultsLogger.RESULTS_MESSAGE_LOGGER.tracef( "JdbcValuesCacheHit#processScroll(%i) : position = %i; numberOfRows = %i", numberOfRows, position, this.numberOfRows ); // NOTE : explicitly skipping limit handling because the cached state should // already be the limited size since the cache key includes limits @@ -127,7 +127,7 @@ public int getPosition() { @Override protected boolean processPosition(int position, RowProcessingState rowProcessingState) { - ResultsLogger.LOGGER.tracef( "JdbcValuesCacheHit#processPosition(%i) : position = %i; numberOfRows = %i", position, this.position, this.numberOfRows ); + ResultsLogger.RESULTS_MESSAGE_LOGGER.tracef( "JdbcValuesCacheHit#processPosition(%i) : position = %i; numberOfRows = %i", position, this.position, this.numberOfRows ); // NOTE : explicitly skipping limit handling because the cached state should // already be the limited size since the cache key includes limits @@ -135,7 +135,7 @@ protected boolean processPosition(int position, RowProcessingState rowProcessing if ( position < 0 ) { // we need to subtract it from `numberOfRows` final int newPosition = numberOfRows + position; - ResultsLogger.LOGGER.debugf( + ResultsLogger.RESULTS_MESSAGE_LOGGER.debugf( "Translated negative absolute position `%i` into `%` based on `%i` number of rows", position, newPosition, @@ -145,7 +145,7 @@ protected boolean processPosition(int position, RowProcessingState rowProcessing } if ( position > numberOfRows ) { - ResultsLogger.LOGGER.debugf( + ResultsLogger.RESULTS_MESSAGE_LOGGER.debugf( "Absolute position `%i` exceeded number of rows `%i`", position, numberOfRows diff --git a/hibernate-core/src/main/java/org/hibernate/tool/schema/ast/SqlScriptLogging.java b/hibernate-core/src/main/java/org/hibernate/tool/schema/ast/SqlScriptLogging.java deleted file mode 100644 index 4249052bea1c..000000000000 --- a/hibernate-core/src/main/java/org/hibernate/tool/schema/ast/SqlScriptLogging.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.tool.schema.ast; - -import org.jboss.logging.Logger; - -/** - * Logging specific to parsing of SQL import scripts used in schema export. - * - * These scripts are processed using Antlr and this logging relates to - * that parsing. - * - * @todo (6.0) - implement usage of this - */ -public class SqlScriptLogging { - public static final String SCRIPT_LOGGER_NAME = "org.hibernate.orm.tooling.schema.script"; - public static final Logger SCRIPT_LOGGER = Logger.getLogger( SCRIPT_LOGGER_NAME ); - - public static final boolean TRACE_ENABLED = SCRIPT_LOGGER.isTraceEnabled(); - public static final boolean DEBUG_ENABLED = SCRIPT_LOGGER.isDebugEnabled(); - - public static final String AST_LOGGER_NAME = SCRIPT_LOGGER_NAME + ".graph"; - public static final Logger AST_LOGGER = Logger.getLogger( AST_LOGGER_NAME ); - - public static final boolean AST_TRACE_ENABLED = AST_LOGGER.isTraceEnabled(); - -} diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/JdbcBindingLogging.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/JdbcBindingLogging.java index 5295978ae730..188ed53a5a3e 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/JdbcBindingLogging.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/JdbcBindingLogging.java @@ -6,10 +6,16 @@ */ package org.hibernate.type.descriptor; +import org.hibernate.internal.log.SubSystemLogging; + import org.jboss.logging.Logger; +@SubSystemLogging( + name = JdbcBindingLogging.NAME, + description = "Logging of JDBC parameter value binding" +) public interface JdbcBindingLogging { - String NAME = "org.hibernate.orm.jdbc.bind"; + String NAME = SubSystemLogging.BASE + ".jdbc.bind"; Logger LOGGER = Logger.getLogger( NAME ); diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/JdbcExtractingLogging.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/JdbcExtractingLogging.java index bd8b28cb3cf3..3fc56b2e9b9d 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/JdbcExtractingLogging.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/JdbcExtractingLogging.java @@ -6,10 +6,16 @@ */ package org.hibernate.type.descriptor; +import org.hibernate.internal.log.SubSystemLogging; + import org.jboss.logging.Logger; +@SubSystemLogging( + name = JdbcExtractingLogging.NAME, + description = "Logging of JDBC value extraction" +) public interface JdbcExtractingLogging { - String NAME = "org.hibernate.orm.jdbc.extract"; + String NAME = SubSystemLogging.BASE + ".jdbc.extract"; Logger LOGGER = Logger.getLogger( NAME ); diff --git a/hibernate-core/src/test/resources/log4j2.properties b/hibernate-core/src/test/resources/log4j2.properties index 37bd5a66c1f6..49ead2c799a7 100644 --- a/hibernate-core/src/test/resources/log4j2.properties +++ b/hibernate-core/src/test/resources/log4j2.properties @@ -40,16 +40,6 @@ logger.jdbc-extract.level=trace logger.graph.name=org.hibernate.orm.graph #logger.graph.level=debug -# SQL import script processing -# NOTE : see org.hibernate.tool.schema.ast.SqlScriptLogging -logger.tooling-schema-script.name=org.hibernate.orm.tooling.schema.script -#logger.tooling-schema-script.level=trace - -# SQL import script parsed AST logging -# NOTE : see org.hibernate.tool.schema.ast.SqlScriptLogging -logger.tooling-schema-script-graph.name=org.hibernate.orm.tooling.schema.script.graph -#logger.tooling-schema-script-graph.level=trace - # Logging related to the creation of DomainResult/Fetch graphs logger.sql-result-graph.name=org.hibernate.orm.sql.results #logger.sql-result-graph.level=debug diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/boot/EnversBootLogger.java b/hibernate-envers/src/main/java/org/hibernate/envers/boot/EnversBootLogger.java index 57c5c7672e60..cdce0dcbc3b7 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/boot/EnversBootLogger.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/boot/EnversBootLogger.java @@ -6,6 +6,8 @@ */ package org.hibernate.envers.boot; +import org.hibernate.internal.log.SubSystemLogging; + import org.jboss.logging.BasicLogger; import org.jboss.logging.Logger; import org.jboss.logging.annotations.LogMessage; @@ -20,6 +22,11 @@ */ @MessageLogger( projectCode = "HHH" ) @ValidIdRange( min = 90005601, max = 90005700 ) +@SubSystemLogging( + name = EnversBootLogger.LOGGER_NAME, + description = "Logging related to bootstrapping an Envers (currently just its in-flight generation " + + "of `hbm.xml` mappings for Hibernate ORM to process)" +) public interface EnversBootLogger extends BasicLogger { String LOGGER_NAME = "org.hibernate.envers.boot"; diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/internal/EnversMessageLogger.java b/hibernate-envers/src/main/java/org/hibernate/envers/internal/EnversMessageLogger.java index 227e663c66df..8d8a1346da9e 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/internal/EnversMessageLogger.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/internal/EnversMessageLogger.java @@ -8,6 +8,7 @@ import org.jboss.logging.BasicLogger; import org.jboss.logging.annotations.MessageLogger; +import org.jboss.logging.annotations.ValidIdRange; /** * The jboss-logging {@link MessageLogger} for the hibernate-envers module. It reserves message ids ranging from @@ -16,6 +17,7 @@ * New messages must be added after the last message defined to ensure message codes are unique. */ @MessageLogger(projectCode = "HHH") +@ValidIdRange(min = 25001, max = 30000) public interface EnversMessageLogger extends BasicLogger { } diff --git a/hibernate-jcache/src/main/java/org/hibernate/cache/jcache/internal/JCacheDomainDataRegionImpl.java b/hibernate-jcache/src/main/java/org/hibernate/cache/jcache/internal/JCacheDomainDataRegionImpl.java index 3ac9552ad637..41e672ed222c 100644 --- a/hibernate-jcache/src/main/java/org/hibernate/cache/jcache/internal/JCacheDomainDataRegionImpl.java +++ b/hibernate-jcache/src/main/java/org/hibernate/cache/jcache/internal/JCacheDomainDataRegionImpl.java @@ -21,6 +21,8 @@ import org.hibernate.cache.spi.support.DomainDataStorageAccess; import org.hibernate.cache.spi.support.RegionFactoryTemplate; +import static org.hibernate.cache.spi.SecondLevelCacheLogger.L2CACHE_LOGGER; + /** * @author Vlad Mihalcea */ @@ -37,7 +39,7 @@ public JCacheDomainDataRegionImpl( @Override protected EntityDataAccess generateTransactionalEntityDataAccess(EntityDataCachingConfig entityAccessConfig) { - SecondLevelCacheLogger.INSTANCE.nonStandardSupportForAccessType( + L2CACHE_LOGGER.nonStandardSupportForAccessType( getName(), AccessType.TRANSACTIONAL.getExternalName(), getRegionFactory().getClass().getSimpleName() @@ -47,7 +49,7 @@ protected EntityDataAccess generateTransactionalEntityDataAccess(EntityDataCachi @Override protected NaturalIdDataAccess generateTransactionalNaturalIdDataAccess(NaturalIdDataCachingConfig accessConfig) { - SecondLevelCacheLogger.INSTANCE.nonStandardSupportForAccessType( + L2CACHE_LOGGER.nonStandardSupportForAccessType( getName(), AccessType.TRANSACTIONAL.getExternalName(), getRegionFactory().getClass().getSimpleName() @@ -57,7 +59,7 @@ protected NaturalIdDataAccess generateTransactionalNaturalIdDataAccess(NaturalId @Override protected CollectionDataAccess generateTransactionalCollectionDataAccess(CollectionDataCachingConfig accessConfig) { - SecondLevelCacheLogger.INSTANCE.nonStandardSupportForAccessType( + L2CACHE_LOGGER.nonStandardSupportForAccessType( getName(), AccessType.TRANSACTIONAL.getExternalName(), getRegionFactory().getClass().getSimpleName() diff --git a/hibernate-jcache/src/main/java/org/hibernate/cache/jcache/internal/JCacheRegionFactory.java b/hibernate-jcache/src/main/java/org/hibernate/cache/jcache/internal/JCacheRegionFactory.java index 2eafcf057855..9339bdb7d57c 100644 --- a/hibernate-jcache/src/main/java/org/hibernate/cache/jcache/internal/JCacheRegionFactory.java +++ b/hibernate-jcache/src/main/java/org/hibernate/cache/jcache/internal/JCacheRegionFactory.java @@ -35,6 +35,8 @@ import org.hibernate.cache.spi.support.StorageAccess; import org.hibernate.engine.spi.SessionFactoryImplementor; +import static org.hibernate.cache.spi.SecondLevelCacheLogger.L2CACHE_LOGGER; + /** * @author Alex Snaps */ @@ -103,7 +105,7 @@ protected Cache getOrCreateCache(String unqualifiedRegionName, S protected Cache createCache(String regionName) { switch ( missingCacheStrategy ) { case CREATE_WARN: - SecondLevelCacheLogger.INSTANCE.missingCacheCreated( + L2CACHE_LOGGER.missingCacheCreated( regionName, ConfigSettings.MISSING_CACHE_STRATEGY, MissingCacheStrategy.CREATE.getExternalRepresentation() ); @@ -163,7 +165,7 @@ protected final String defaultRegionName(String regionName, SessionFactoryImplem for ( String legacyDefaultRegionName : legacyDefaultRegionNames ) { if ( cacheExists( legacyDefaultRegionName, sessionFactory ) ) { - SecondLevelCacheLogger.INSTANCE.usingLegacyCacheName( defaultRegionName, legacyDefaultRegionName ); + L2CACHE_LOGGER.usingLegacyCacheName( defaultRegionName, legacyDefaultRegionName ); return legacyDefaultRegionName; } } diff --git a/hibernate-jcache/src/test/java/org/hibernate/orm/test/jcache/MissingCacheStrategyTest.java b/hibernate-jcache/src/test/java/org/hibernate/orm/test/jcache/MissingCacheStrategyTest.java index 6b41b5535fc8..df3673de32fa 100644 --- a/hibernate-jcache/src/test/java/org/hibernate/orm/test/jcache/MissingCacheStrategyTest.java +++ b/hibernate-jcache/src/test/java/org/hibernate/orm/test/jcache/MissingCacheStrategyTest.java @@ -15,7 +15,6 @@ import org.hibernate.cache.jcache.ConfigSettings; import org.hibernate.cache.spi.SecondLevelCacheLogger; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.orm.test.jcache.TestHelper; import org.hibernate.service.spi.ServiceException; import org.hibernate.testing.junit4.BaseUnitTestCase; @@ -42,7 +41,7 @@ public class MissingCacheStrategyTest extends BaseUnitTestCase { @Rule - public LoggerInspectionRule logInspection = new LoggerInspectionRule( SecondLevelCacheLogger.INSTANCE ); + public LoggerInspectionRule logInspection = new LoggerInspectionRule( SecondLevelCacheLogger.L2CACHE_LOGGER ); @Test public void testMissingCacheStrategyDefault() { diff --git a/hibernate-orm-build/src/main/java/org/hibernate/orm/post/IndexManager.java b/hibernate-orm-build/src/main/java/org/hibernate/orm/post/IndexManager.java index 2fb7ef0086a8..c122b148919b 100644 --- a/hibernate-orm-build/src/main/java/org/hibernate/orm/post/IndexManager.java +++ b/hibernate-orm-build/src/main/java/org/hibernate/orm/post/IndexManager.java @@ -12,7 +12,9 @@ import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; +import java.nio.file.Files; import java.util.Comparator; +import java.util.List; import java.util.Set; import java.util.TreeSet; @@ -27,6 +29,7 @@ import org.jboss.jandex.ClassInfo; import org.jboss.jandex.Index; +import org.jboss.jandex.IndexReader; import org.jboss.jandex.IndexWriter; import org.jboss.jandex.Indexer; @@ -48,10 +51,10 @@ public IndexManager(Configuration artifactsToProcess, Project project) { this.artifactsToProcess = artifactsToProcess; this.indexFileReferenceAccess = project.getLayout() .getBuildDirectory() - .file( "reports/orm/indexing/jandex.idx" ); + .file( "orm/reports/indexing/jandex.idx" ); this.packageFileReferenceAccess = project.getLayout() .getBuildDirectory() - .file( "reports/orm/indexing/internal-packages.txt" ); + .file( "orm/reports/indexing/internal-packages.txt" ); this.project = project; } @@ -73,19 +76,60 @@ public TreeSet getInternalPackageNames() { public Index getIndex() { if ( index == null ) { - throw new IllegalStateException( "Index has not been created yet" ); + index = loadIndex( indexFileReferenceAccess ); + internalPackageNames = loadInternalPackageNames( packageFileReferenceAccess ); } return index; } + private static Index loadIndex(Provider indexFileReferenceAccess) { + final File indexFile = indexFileReferenceAccess.get().getAsFile(); + if ( !indexFile.exists() ) { + throw new IllegalStateException( "Cannot load index; the stored file does not exist - " + indexFile.getAbsolutePath() ); + } + + try ( final FileInputStream stream = new FileInputStream( indexFile ) ) { + final IndexReader indexReader = new IndexReader( stream ); + return indexReader.read(); + } + catch (FileNotFoundException e) { + throw new IllegalStateException( "Cannot load index; the stored file does not exist - " + indexFile.getAbsolutePath(), e ); + } + catch (IOException e) { + throw new IllegalStateException( "Cannot load index; unable to read stored file - " + indexFile.getAbsolutePath(), e ); + } + } + + private static TreeSet loadInternalPackageNames(Provider packageFileReferenceAccess) { + final File packageNameFile = packageFileReferenceAccess.get().getAsFile(); + if ( !packageNameFile.exists() ) { + throw new IllegalStateException( "Cannot load internal packages; the stored file does not exist - " + packageNameFile.getAbsolutePath() ); + } + + final TreeSet inclusions = new TreeSet<>( Comparator.comparing( Inclusion::getPath ) ); + try { + final List lines = Files.readAllLines( packageNameFile.toPath() ); + lines.forEach( (line) -> { + if ( line == null || line.isEmpty() ) { + return; + } + + inclusions.add( new Inclusion( line, true ) ); + } ); + return inclusions; + } + catch (IOException e) { + throw new RuntimeException( "Unable to read package-name file - " + packageNameFile.getAbsolutePath(), e ); + } + } + /** * Used from {@link IndexerTask} as its action */ void index() { if ( index != null ) { - assert internalPackageNames != null; - return; + throw new IllegalStateException( "Index was already created or loaded" ); } final Indexer indexer = new Indexer(); diff --git a/hibernate-orm-build/src/main/java/org/hibernate/orm/post/LoggingReportTask.java b/hibernate-orm-build/src/main/java/org/hibernate/orm/post/LoggingReportTask.java index c1d5389c6bdf..c1b96834e7dd 100644 --- a/hibernate-orm-build/src/main/java/org/hibernate/orm/post/LoggingReportTask.java +++ b/hibernate-orm-build/src/main/java/org/hibernate/orm/post/LoggingReportTask.java @@ -6,25 +6,147 @@ */ package org.hibernate.orm.post; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.util.List; +import java.util.TreeMap; import javax.inject.Inject; import org.gradle.api.Project; import org.gradle.api.tasks.TaskAction; +import org.jboss.jandex.AnnotationInstance; +import org.jboss.jandex.DotName; +import org.jboss.jandex.Index; + +import static org.jboss.jandex.DotName.createSimple; + /** * @author Steve Ebersole */ public abstract class LoggingReportTask extends AbstractJandexAwareTask { + public static final DotName SUB_SYS_ANN_NAME = createSimple( "org.hibernate.internal.log.SubSystemLogging" ); + @Inject public LoggingReportTask(IndexManager indexManager, Project project) { super( indexManager, - project.getLayout().getBuildDirectory().file( "reports/orm/logging.txt" ) + project.getLayout().getBuildDirectory().file( "reports/orm/logging.adoc" ) ); } @TaskAction public void generateLoggingReport() { - getProject().getLogger().lifecycle( "Logging report not implemented yet" ); + final TreeMap subSystemByName = new TreeMap<>(); + + final Index index = getIndexManager().getIndex(); + final List subSysAnnUsages = index.getAnnotations( SUB_SYS_ANN_NAME ); + + subSysAnnUsages.forEach( (ann) -> { + final SubSystem subSystem = new SubSystem( + ann.value( "name" ).asString(), + ann.value( "description" ).asString(), + ann.target().asClass().simpleName() + ); + subSystemByName.put( subSystem.name, subSystem ); + } ); + + generateReport( subSystemByName ); + } + + + private void generateReport(TreeMap subSystemByName) { + final File reportFile = prepareReportFile(); + assert reportFile.exists(); + + try ( final OutputStreamWriter fileWriter = new OutputStreamWriter( new FileOutputStream( reportFile ) ) ) { + writeReport( subSystemByName, fileWriter ); + } + catch (FileNotFoundException e) { + throw new RuntimeException( "Should never happen" ); + } + catch (IOException e) { + throw new RuntimeException( "Error writing to report file", e ); + } + + } + + private void writeReport(TreeMap subSystemByName, OutputStreamWriter fileWriter) { + // for the moment, just dump these to a file in simple text format. + // + // ultimately come back and create an asciidoctor-formatted file + // and run through the asciidoctor task + + try { + fileWriter.write( "= Hibernate logging\n\n" ); + + fileWriter.write( "== Sub-system logging\n\n" ); + subSystemByName.forEach( (name, subSystem) -> { + try { + fileWriter.write( "[[" + subSystem.getAnchorName() + "]]\n" ); + fileWriter.write( "`" + subSystem.getName() + "`::\n" ); + fileWriter.write( " * Logging class-name = `" + subSystem.getLoggingClassName() + "`\n" ); + fileWriter.write( " * Description = " + subSystem.getDescription() + "\n" ); + } + catch (IOException e) { + throw new RuntimeException( "Error writing sub-system entry (" + subSystem.getAnchorName() + ") to report file", e ); + } + } ); + } + catch (IOException e) { + throw new RuntimeException( "Error writing to report file", e ); + } + } + + + private static class SubSystem { + private final String name; + private final String description; + private final String loggingClassName; + + private final String anchorName; + + public SubSystem(String name, String description, String loggingClassName) { + this.name = name; + this.description = description; + this.loggingClassName = loggingClassName; + + this.anchorName = determineAnchorName( name ); + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public String getLoggingClassName() { + return loggingClassName; + } + + public String getAnchorName() { + return anchorName; + } + + private static String determineAnchorName(final String name) { + final String baseName; + if ( name.startsWith( "org.hibernate.orm." ) ) { + baseName = name.substring( "org.hibernate.orm.".length() ); + } + else if ( name.startsWith( "org.hibernate." ) ) { + baseName = name.substring( "org.hibernate.".length() ); + } + else { + baseName = name; + } + + return baseName.replace( '.', '_' ); + } } + } diff --git a/hibernate-orm-build/src/main/java/org/hibernate/orm/post/LoggingReportTask2.java b/hibernate-orm-build/src/main/java/org/hibernate/orm/post/LoggingReportTask2.java new file mode 100644 index 000000000000..9fcd4d0ddc41 --- /dev/null +++ b/hibernate-orm-build/src/main/java/org/hibernate/orm/post/LoggingReportTask2.java @@ -0,0 +1,317 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later + * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html + */ +package org.hibernate.orm.post; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.lang.annotation.RetentionPolicy; +import java.util.Comparator; +import java.util.List; +import java.util.TreeMap; +import java.util.TreeSet; +import javax.inject.Inject; + +import org.gradle.api.Project; +import org.gradle.api.tasks.TaskAction; + +import org.jboss.jandex.AnnotationInstance; +import org.jboss.jandex.ClassInfo; +import org.jboss.jandex.DotName; +import org.jboss.jandex.Index; + +import static org.jboss.jandex.DotName.createSimple; + +/** + * This one would be nice to support, but Jandex is unable to read the annotations + * from JBoss Logging because it defines those annotations with {@link RetentionPolicy#CLASS}; + * Jandex can only read annotations marked with {@link RetentionPolicy#RUNTIME} + * + * @see LoggingReportTask + * + * @author Steve Ebersole + */ +public abstract class LoggingReportTask2 extends AbstractJandexAwareTask { + public static final DotName SUB_SYS_ANN_NAME = createSimple( "org.hibernate.internal.log.SubSystemLogging" ); + + public static final DotName MSG_LOGGER_ANN_NAME = createSimple( "org.jboss.logging.annotations.MessageLogger" ); + public static final DotName ID_RANGE_ANN_NAME = createSimple( "org.jboss.logging.annotations.ValidIdRange" ); + public static final DotName MSG_ANN_NAME = createSimple( "org.jboss.logging.annotations.Message" ); + + @Inject + public LoggingReportTask2(IndexManager indexManager, Project project) { + super( + indexManager, + project.getLayout().getBuildDirectory().file( "reports/orm/logging.adoc" ) + ); + } + + @TaskAction + public void generateLoggingReport() { + final TreeMap subSystemByName = new TreeMap<>(); + final TreeSet idRanges = new TreeSet<>( Comparator.comparing( IdRange::getMinValue ) ); + + final Index index = getIndexManager().getIndex(); + final List subSysAnnUsages = index.getAnnotations( SUB_SYS_ANN_NAME ); + final List msgLoggerAnnUsages = index.getAnnotations( MSG_LOGGER_ANN_NAME ); + + subSysAnnUsages.forEach( (ann) -> { + final SubSystem subSystem = new SubSystem( + ann.value( "name" ).asString(), + ann.value( "description" ).asString(), + ann.target().asClass().simpleName() + ); + subSystemByName.put( subSystem.name, subSystem ); + } ); + + + msgLoggerAnnUsages.forEach( (msgLoggerAnnUsage) -> { + // find its id-range annotation, if one + final ClassInfo loggerClassInfo = msgLoggerAnnUsage.target().asClass(); + final AnnotationInstance subSystemAnnUsage = loggerClassInfo.classAnnotation( SUB_SYS_ANN_NAME ); + + final SubSystem subSystem; + if ( subSystemAnnUsage != null ) { + subSystem = subSystemByName.get( subSystemAnnUsage.value( "name" ).asString() ); + } + else { + subSystem = null; + } + + final IdRange idRange; + final AnnotationInstance idRangeAnnUsage = loggerClassInfo.classAnnotation( ID_RANGE_ANN_NAME ); + if ( idRangeAnnUsage == null ) { + idRange = calculateIdRange( msgLoggerAnnUsage, subSystem ); + } + else { + idRange = new IdRange( + idRangeAnnUsage.value( "min" ).asInt(), + idRangeAnnUsage.value( "maz" ).asInt(), + loggerClassInfo.simpleName(), + true, + subSystem + ); + if ( subSystem != null ) { + subSystem.idRange = idRange; + } + } + + if ( idRange != null ) { + idRanges.add( idRange ); + } + } ); + + generateReport( subSystemByName, idRanges ); + } + + + private IdRange calculateIdRange(AnnotationInstance msgLoggerAnnUsage, SubSystem subSystem) { + final ClassInfo loggerClassInfo = msgLoggerAnnUsage.target().asClass(); + getProject().getLogger().lifecycle( "MessageLogger (`%s`) missing id-range", loggerClassInfo.simpleName() ); + + final List messageAnnUsages = loggerClassInfo.annotations().get( MSG_ANN_NAME ); + if ( messageAnnUsages.isEmpty() ) { + return null; + } + + int minId = Integer.MAX_VALUE; + int maxId = Integer.MIN_VALUE; + + for ( int i = 0; i < messageAnnUsages.size(); i++ ) { + final AnnotationInstance msgAnnUsage = messageAnnUsages.get( i ); + final int msgId = msgAnnUsage.value( "id" ).asInt(); + + if ( msgId < minId ) { + minId = msgId; + } + else if ( msgId > maxId ) { + maxId = msgId; + } + } + + return new IdRange( minId, maxId, loggerClassInfo.simpleName(), false, subSystem ); + } + + private void generateReport(TreeMap subSystemByName, TreeSet idRanges) { + final File reportFile = prepareReportFile(); + assert reportFile.exists(); + + try ( final OutputStreamWriter fileWriter = new OutputStreamWriter( new FileOutputStream( reportFile ) ) ) { + writeReport( subSystemByName, idRanges, fileWriter ); + } + catch (FileNotFoundException e) { + throw new RuntimeException( "Should never happen" ); + } + catch (IOException e) { + throw new RuntimeException( "Error writing to report file", e ); + } + + } + + private void writeReport(TreeMap subSystemByName, TreeSet idRanges, OutputStreamWriter fileWriter) { + // for the moment, just dump these to a file in simple text format. + // + // ultimately come back and create an asciidoctor-formatted file + // and run through the asciidoctor task + + try { + fileWriter.write( "= Hibernate logging\n\n" ); + + fileWriter.write( "== Sub-system logging\n\n" ); + subSystemByName.forEach( (name, subSystem) -> { + try { + fileWriter.write( "[[" + subSystem.getAnchorName() + "]]\n" ); + fileWriter.write( "`" + subSystem.getName() + "`::\n" ); + fileWriter.write( " * Logging class-name = `" + subSystem.getLoggingClassName() + "`\n" ); + fileWriter.write( " * Description = " + subSystem.getDescription() + "\n" ); + if ( subSystem.getIdRange() == null ) { + fileWriter.write( " * id-range = no\n" ); + } + else { + fileWriter.write( " * id-range = <<" + subSystem.getIdRange().anchorName + ",yes>>\n" ); + } + } + catch (IOException e) { + throw new RuntimeException( "Error writing sub-system entry (" + subSystem.getAnchorName() + ") to report file", e ); + } + } ); + + fileWriter.write( "\n\n" ); + fileWriter.write( "== Keyed message logging\n\n" ); + idRanges.forEach( (idRange) -> { + try { + fileWriter.write( "[[" + idRange.getAnchorName() + "]]\n" ); + fileWriter.write( "`" + idRange.getLabel() + "`::\n" ); + fileWriter.write( " * MessageLogger class = `" + idRange.getLoggerClassName() + "`\n" ); + fileWriter.write( " * Explicit? = " + idRange.isExplicit() + "\n" ); + final SubSystem subSystem = idRange.getSubSystem(); + if ( subSystem == null ) { + fileWriter.write( " * sub-system? = no\n" ); + } + else { + fileWriter.write( " * sub-system? = <<" + subSystem.getAnchorName() + ",yes>>\n" ); + } + } + catch (IOException e) { + throw new RuntimeException( "Error writing msg-id entry (" + idRange.getAnchorName() + ") to report file", e ); + } + } ); + } + catch (IOException e) { + throw new RuntimeException( "Error writing to report file", e ); + } + } + + + private static class SubSystem { + private final String name; + private final String description; + private final String loggingClassName; + + private final String anchorName; + + private IdRange idRange; + + public SubSystem(String name, String description, String loggingClassName) { + this.name = name; + this.description = description; + this.loggingClassName = loggingClassName; + + this.anchorName = determineAnchorName( name ); + } + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public String getLoggingClassName() { + return loggingClassName; + } + + public String getAnchorName() { + return anchorName; + } + + public IdRange getIdRange() { + return idRange; + } + + private static String determineAnchorName(final String name) { + final String baseName; + if ( name.startsWith( "org.hibernate.orm." ) ) { + baseName = name.substring( "org.hibernate.orm.".length() ); + } + else if ( name.startsWith( "org.hibernate." ) ) { + baseName = name.substring( "org.hibernate.".length() ); + } + else { + baseName = name; + } + + return baseName.replace( '.', '_' ); + } + } + + private static class IdRange { + private final int minValue; + private final int maxValue; + private final String loggerClassName; + private final boolean explicit; + private final SubSystem subSystem; + + private final String anchorName; + + public IdRange( + int minValue, + int maxValue, + String loggerClassName, + boolean explicit, + SubSystem subSystem) { + this.minValue = minValue; + this.maxValue = maxValue; + this.loggerClassName = loggerClassName; + this.explicit = explicit; + this.subSystem = subSystem; + + this.anchorName = "HHH" + minValue; + } + + public int getMinValue() { + return minValue; + } + + public int getMaxValue() { + return maxValue; + } + + public String getLoggerClassName() { + return loggerClassName; + } + + public boolean isExplicit() { + return explicit; + } + + public SubSystem getSubSystem() { + return subSystem; + } + + public String getAnchorName() { + return anchorName; + } + + public String getLabel() { + return String.format( "HHH%06d - HHH%06d", minValue, maxValue ); + } + } +} diff --git a/hibernate-orm-build/src/main/java/org/hibernate/orm/post/ReportGenerationPlugin.java b/hibernate-orm-build/src/main/java/org/hibernate/orm/post/ReportGenerationPlugin.java index cfa0b0c1a5a6..a5009811a73b 100644 --- a/hibernate-orm-build/src/main/java/org/hibernate/orm/post/ReportGenerationPlugin.java +++ b/hibernate-orm-build/src/main/java/org/hibernate/orm/post/ReportGenerationPlugin.java @@ -8,6 +8,7 @@ import org.gradle.api.Plugin; import org.gradle.api.Project; +import org.gradle.api.Task; import org.gradle.api.artifacts.Configuration; /** @@ -23,32 +24,39 @@ public void apply(Project project) { .maybeCreate( CONFIG_NAME ) .setDescription( "Used to collect the jars with classes files to be used in the aggregation reports for `@Internal`, `@Incubating`, etc" ); + final Task groupingTask = project.getTasks().maybeCreate( "generateHibernateReports" ); + groupingTask.setGroup( TASK_GROUP_NAME ); + final IndexManager indexManager = new IndexManager( artifactsToProcess, project ); final IndexerTask indexerTask = project.getTasks().create( "buildAggregatedIndex", IndexerTask.class, indexManager ); + groupingTask.dependsOn( indexerTask ); final IncubationReportTask incubatingTask = project.getTasks().create( - "createIncubationReport", + "generateIncubationReport", IncubationReportTask.class, indexManager ); incubatingTask.dependsOn( indexerTask ); + groupingTask.dependsOn( incubatingTask ); final InternalsReportTask internalsTask = project.getTasks().create( - "createInternalsReport", + "generateInternalsReport", InternalsReportTask.class, indexManager ); internalsTask.dependsOn( indexerTask ); + groupingTask.dependsOn( internalsTask ); final LoggingReportTask loggingTask = project.getTasks().create( - "createLoggingReport", + "generateLoggingReport", LoggingReportTask.class, indexManager ); loggingTask.dependsOn( indexerTask ); + groupingTask.dependsOn( loggingTask ); } } diff --git a/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/ProxoolConnectionProvider.java b/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/ProxoolConnectionProvider.java index a32df48727bd..809db92609d5 100644 --- a/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/ProxoolConnectionProvider.java +++ b/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/ProxoolConnectionProvider.java @@ -28,13 +28,14 @@ import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.spi.Stoppable; -import org.jboss.logging.Logger; - import org.logicalcobwebs.proxool.ProxoolException; import org.logicalcobwebs.proxool.ProxoolFacade; import org.logicalcobwebs.proxool.configuration.JAXPConfigurator; import org.logicalcobwebs.proxool.configuration.PropertyConfigurator; +import static org.hibernate.proxool.internal.ProxoolMessageLogger.PROXOOL_LOGGER; +import static org.hibernate.proxool.internal.ProxoolMessageLogger.PROXOOL_MESSAGE_LOGGER; + /** * A connection provider that uses a Proxool connection pool. Hibernate will use this by * default if the {@code hibernate.proxool.*} properties are set. @@ -43,10 +44,6 @@ */ public class ProxoolConnectionProvider implements ConnectionProvider, Configurable, Stoppable, ServiceRegistryAwareService { - private static final ProxoolMessageLogger LOG = Logger.getMessageLogger( - ProxoolMessageLogger.class, - ProxoolConnectionProvider.class.getName() - ); private static final String PROXOOL_JDBC_STEM = "proxool."; @@ -125,8 +122,8 @@ public void configure(Map props) { if ( "true".equals( externalConfig ) ) { // Validate that an alias name was provided to determine which pool to use if ( !StringHelper.isNotEmpty( proxoolAlias ) ) { - final String msg = LOG.unableToConfigureProxoolProviderToUseExistingInMemoryPool( Environment.PROXOOL_POOL_ALIAS ); - LOG.error( msg ); + final String msg = PROXOOL_MESSAGE_LOGGER.unableToConfigureProxoolProviderToUseExistingInMemoryPool( Environment.PROXOOL_POOL_ALIAS ); + PROXOOL_LOGGER.error( msg ); throw new HibernateException( msg ); } // Append the stem to the proxool pool alias @@ -135,17 +132,17 @@ public void configure(Map props) { // Set the existing pool flag to true existingPool = true; - LOG.configuringProxoolProviderUsingExistingPool( proxoolAlias ); + PROXOOL_MESSAGE_LOGGER.configuringProxoolProviderUsingExistingPool( proxoolAlias ); // Configured using the JAXP Configurator } else if ( StringHelper.isNotEmpty( jaxpFile ) ) { - LOG.configuringProxoolProviderUsingJaxpConfigurator( jaxpFile ); + PROXOOL_MESSAGE_LOGGER.configuringProxoolProviderUsingJaxpConfigurator( jaxpFile ); // Validate that an alias name was provided to determine which pool to use if ( !StringHelper.isNotEmpty( proxoolAlias ) ) { - final String msg = LOG.unableToConfigureProxoolProviderToUseJaxp( Environment.PROXOOL_POOL_ALIAS ); - LOG.error( msg ); + final String msg = PROXOOL_MESSAGE_LOGGER.unableToConfigureProxoolProviderToUseJaxp( Environment.PROXOOL_POOL_ALIAS ); + PROXOOL_LOGGER.error( msg ); throw new HibernateException( msg ); } @@ -153,24 +150,24 @@ else if ( StringHelper.isNotEmpty( jaxpFile ) ) { JAXPConfigurator.configure( getConfigStreamReader( jaxpFile ), false ); } catch (ProxoolException e) { - final String msg = LOG.unableToLoadJaxpConfiguratorFile( jaxpFile ); - LOG.error( msg, e ); + final String msg = PROXOOL_MESSAGE_LOGGER.unableToLoadJaxpConfiguratorFile( jaxpFile ); + PROXOOL_LOGGER.error( msg, e ); throw new HibernateException( msg, e ); } // Append the stem to the proxool pool alias proxoolAlias = PROXOOL_JDBC_STEM + proxoolAlias; - LOG.configuringProxoolProviderToUsePoolAlias( proxoolAlias ); + PROXOOL_MESSAGE_LOGGER.configuringProxoolProviderToUsePoolAlias( proxoolAlias ); // Configured using the Properties File Configurator } else if ( StringHelper.isNotEmpty( propFile ) ) { - LOG.configuringProxoolProviderUsingPropertiesFile( propFile ); + PROXOOL_MESSAGE_LOGGER.configuringProxoolProviderUsingPropertiesFile( propFile ); // Validate that an alias name was provided to determine which pool to use if ( !StringHelper.isNotEmpty( proxoolAlias ) ) { - final String msg = LOG.unableToConfigureProxoolProviderToUsePropertiesFile( Environment.PROXOOL_POOL_ALIAS ); - LOG.error( msg ); + final String msg = PROXOOL_MESSAGE_LOGGER.unableToConfigureProxoolProviderToUsePropertiesFile( Environment.PROXOOL_POOL_ALIAS ); + PROXOOL_LOGGER.error( msg ); throw new HibernateException( msg ); } @@ -178,22 +175,22 @@ else if ( StringHelper.isNotEmpty( propFile ) ) { PropertyConfigurator.configure( getConfigProperties( propFile ) ); } catch (ProxoolException e) { - final String msg = LOG.unableToLoadPropertyConfiguratorFile( propFile ); - LOG.error( msg, e ); + final String msg = PROXOOL_MESSAGE_LOGGER.unableToLoadPropertyConfiguratorFile( propFile ); + PROXOOL_LOGGER.error( msg, e ); throw new HibernateException( msg, e ); } // Append the stem to the proxool pool alias proxoolAlias = PROXOOL_JDBC_STEM + proxoolAlias; - LOG.configuringProxoolProviderToUsePoolAlias( proxoolAlias ); + PROXOOL_MESSAGE_LOGGER.configuringProxoolProviderToUsePoolAlias( proxoolAlias ); } // Remember Isolation level isolation = ConnectionProviderInitiator.extractIsolation( props ); - LOG.jdbcIsolationLevel( ConnectionProviderInitiator.toIsolationNiceName( isolation ) ); + PROXOOL_MESSAGE_LOGGER.jdbcIsolationLevel( ConnectionProviderInitiator.toIsolationNiceName( isolation ) ); autocommit = ConfigurationHelper.getBoolean( Environment.AUTOCOMMIT, props ); - LOG.autoCommitMode( autocommit ); + PROXOOL_MESSAGE_LOGGER.autoCommitMode( autocommit ); } private Reader getConfigStreamReader(String resource) { @@ -236,8 +233,8 @@ public void stop() { catch (Exception e) { // If you're closing down the ConnectionProvider chances are an // is not a real big deal, just warn - final String msg = LOG.exceptionClosingProxoolPool(); - LOG.warn( msg, e ); + final String msg = PROXOOL_MESSAGE_LOGGER.exceptionClosingProxoolPool(); + PROXOOL_LOGGER.warn( msg, e ); throw new HibernateException( msg, e ); } } diff --git a/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/ProxoolMessageLogger.java b/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/ProxoolMessageLogger.java index a661a57d3180..1d9f22b62eb7 100644 --- a/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/ProxoolMessageLogger.java +++ b/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/ProxoolMessageLogger.java @@ -7,7 +7,9 @@ package org.hibernate.proxool.internal; import org.hibernate.internal.log.ConnectionPoolingLogger; +import org.hibernate.internal.log.SubSystemLogging; +import org.jboss.logging.Logger; import org.jboss.logging.annotations.LogMessage; import org.jboss.logging.annotations.Message; import org.jboss.logging.annotations.MessageLogger; @@ -23,7 +25,14 @@ */ @MessageLogger(projectCode = "HHH") @ValidIdRange( min = 30001, max = 35000 ) +@SubSystemLogging( + name = ProxoolMessageLogger.LOGGER_NAME, + description = "Logs details related to Proxool connection pooling" +) public interface ProxoolMessageLogger extends ConnectionPoolingLogger { + String LOGGER_NAME = ConnectionPoolingLogger.LOGGER_NAME + ".proxool"; + Logger PROXOOL_LOGGER = Logger.getLogger( LOGGER_NAME ); + ProxoolMessageLogger PROXOOL_MESSAGE_LOGGER = Logger.getMessageLogger( ProxoolMessageLogger.class, LOGGER_NAME ); /** * Logs the name of a named pool to be used for configuration information diff --git a/hibernate-spatial/src/main/java/org/hibernate/spatial/HSMessageLogger.java b/hibernate-spatial/src/main/java/org/hibernate/spatial/HSMessageLogger.java index 09d0ac3fc713..bbb77465812e 100644 --- a/hibernate-spatial/src/main/java/org/hibernate/spatial/HSMessageLogger.java +++ b/hibernate-spatial/src/main/java/org/hibernate/spatial/HSMessageLogger.java @@ -7,6 +7,8 @@ package org.hibernate.spatial; +import org.hibernate.internal.log.SubSystemLogging; + import org.jboss.logging.BasicLogger; import org.jboss.logging.Logger; import org.jboss.logging.annotations.LogMessage; @@ -23,11 +25,16 @@ */ @MessageLogger(projectCode = "HHH") @ValidIdRange(min = 80000001, max = 80001000) +@SubSystemLogging( + name = HSMessageLogger.LOGGER_NAME, + description = "Base logging for Hibernate Spatial", + mixed = true +) public interface HSMessageLogger extends BasicLogger { String LOGGER_NAME = "org.hibernate.spatial"; - HSMessageLogger LOGGER = Logger.getMessageLogger( HSMessageLogger.class, LOGGER_NAME ); + HSMessageLogger SPATIAL_MSG_LOGGER = Logger.getMessageLogger( HSMessageLogger.class, LOGGER_NAME ); @LogMessage(level = INFO) @Message(value = "hibernate-spatial integration enabled : %s", id = 80000001) diff --git a/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/cockroachdb/CockroachDbContributor.java b/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/cockroachdb/CockroachDbContributor.java index 407bdbe7cf5b..7051a90f67b7 100644 --- a/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/cockroachdb/CockroachDbContributor.java +++ b/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/cockroachdb/CockroachDbContributor.java @@ -27,13 +27,13 @@ public CockroachDbContributor(ServiceRegistry serviceRegistry) { @Override public void contributeJdbcTypes(TypeContributions typeContributions) { - HSMessageLogger.LOGGER.typeContributions( this.getClass().getCanonicalName() ); + HSMessageLogger.SPATIAL_MSG_LOGGER.typeContributions( this.getClass().getCanonicalName() ); typeContributions.contributeJdbcType( PGGeometryJdbcType.INSTANCE_WKB_2 ); } @Override public void contributeFunctions(FunctionContributions functionContributions) { - HSMessageLogger.LOGGER.functionContributions( this.getClass().getCanonicalName() ); + HSMessageLogger.SPATIAL_MSG_LOGGER.functionContributions( this.getClass().getCanonicalName() ); final PostgisSqmFunctionDescriptors postgisFunctions = new PostgisSqmFunctionDescriptors( functionContributions ); final SqmFunctionRegistry functionRegistry = functionContributions.getFunctionRegistry(); diff --git a/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/h2gis/H2GisDialectContributor.java b/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/h2gis/H2GisDialectContributor.java index 656f7760cec2..2a242ae0d412 100644 --- a/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/h2gis/H2GisDialectContributor.java +++ b/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/h2gis/H2GisDialectContributor.java @@ -24,13 +24,13 @@ public H2GisDialectContributor(ServiceRegistry serviceRegistry) { } public void contributeJdbcTypes(TypeContributions typeContributions) { - HSMessageLogger.LOGGER.typeContributions( this.getClass().getCanonicalName() ); + HSMessageLogger.SPATIAL_MSG_LOGGER.typeContributions( this.getClass().getCanonicalName() ); typeContributions.contributeJdbcType( H2GISGeometryType.INSTANCE ); } @Override public void contributeFunctions(FunctionContributions functionContributions) { - HSMessageLogger.LOGGER.functionContributions( this.getClass().getCanonicalName() ); + HSMessageLogger.SPATIAL_MSG_LOGGER.functionContributions( this.getClass().getCanonicalName() ); final KeyedSqmFunctionDescriptors functions = new H2SqmFunctionDescriptors( functionContributions ); final SqmFunctionRegistry functionRegistry = functionContributions.getFunctionRegistry(); functions.asMap().forEach( (key, desc) -> { diff --git a/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/mariadb/MariaDBDialectContributor.java b/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/mariadb/MariaDBDialectContributor.java index 2d09099ec437..3e8f5890e859 100644 --- a/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/mariadb/MariaDBDialectContributor.java +++ b/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/mariadb/MariaDBDialectContributor.java @@ -25,13 +25,13 @@ public MariaDBDialectContributor(ServiceRegistry serviceRegistry) { } public void contributeJdbcTypes(TypeContributions typeContributions) { - HSMessageLogger.LOGGER.typeContributions( this.getClass().getCanonicalName() ); + HSMessageLogger.SPATIAL_MSG_LOGGER.typeContributions( this.getClass().getCanonicalName() ); typeContributions.contributeJdbcType( MySQLGeometryJdbcType.INSTANCE ); } @Override public void contributeFunctions(FunctionContributions functionContributions) { - HSMessageLogger.LOGGER.functionContributions( this.getClass().getCanonicalName() ); + HSMessageLogger.SPATIAL_MSG_LOGGER.functionContributions( this.getClass().getCanonicalName() ); final KeyedSqmFunctionDescriptors mariaDbFunctions = new MariaDBSqmFunctionDescriptors( functionContributions ); final SqmFunctionRegistry functionRegistry = functionContributions.getFunctionRegistry(); mariaDbFunctions.asMap().forEach( (key, desc) -> { diff --git a/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/mysql/MySQLDialectContributor.java b/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/mysql/MySQLDialectContributor.java index a69c9f3021ce..1fb8d614c43e 100644 --- a/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/mysql/MySQLDialectContributor.java +++ b/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/mysql/MySQLDialectContributor.java @@ -25,13 +25,13 @@ public MySQLDialectContributor(ServiceRegistry serviceRegistry) { @Override public void contributeJdbcTypes(TypeContributions typeContributions) { - HSMessageLogger.LOGGER.typeContributions( this.getClass().getCanonicalName() ); + HSMessageLogger.SPATIAL_MSG_LOGGER.typeContributions( this.getClass().getCanonicalName() ); typeContributions.contributeJdbcType( MySQLGeometryJdbcType.INSTANCE); } @Override public void contributeFunctions(FunctionContributions functionContributions) { - HSMessageLogger.LOGGER.functionContributions( this.getClass().getCanonicalName() ); + HSMessageLogger.SPATIAL_MSG_LOGGER.functionContributions( this.getClass().getCanonicalName() ); final KeyedSqmFunctionDescriptors mysqlFunctions = new MySqlSqmFunctionDescriptors( functionContributions ); final SqmFunctionRegistry functionRegistry = functionContributions.getFunctionRegistry(); mysqlFunctions.asMap().forEach( (key, desc) -> { diff --git a/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/oracle/OracleDialectContributor.java b/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/oracle/OracleDialectContributor.java index b37db20c2d65..3fc774e3d678 100644 --- a/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/oracle/OracleDialectContributor.java +++ b/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/oracle/OracleDialectContributor.java @@ -39,7 +39,7 @@ public OracleDialectContributor(ServiceRegistry serviceRegistry) { @Override public void contributeJdbcTypes(TypeContributions typeContributions) { - HSMessageLogger.LOGGER.typeContributions( this.getClass().getCanonicalName() ); + HSMessageLogger.SPATIAL_MSG_LOGGER.typeContributions( this.getClass().getCanonicalName() ); final ConfigurationService cfgService = getServiceRegistry().getService( ConfigurationService.class ); final StrategySelector strategySelector = getServiceRegistry().getService( StrategySelector.class ); @@ -53,7 +53,7 @@ public void contributeJdbcTypes(TypeContributions typeContributions) { ) ); - HSMessageLogger.LOGGER.connectionFinder( connectionFinder.getClass().getCanonicalName() ); + HSMessageLogger.SPATIAL_MSG_LOGGER.connectionFinder( connectionFinder.getClass().getCanonicalName() ); SDOGeometryType sdoGeometryType = new SDOGeometryType( new OracleJDBCTypeFactory( connectionFinder ), useSTGeometry @@ -64,7 +64,7 @@ public void contributeJdbcTypes(TypeContributions typeContributions) { @Override public void contributeFunctions(FunctionContributions functionContributions) { - HSMessageLogger.LOGGER.functionContributions( this.getClass().getCanonicalName() ); + HSMessageLogger.SPATIAL_MSG_LOGGER.functionContributions( this.getClass().getCanonicalName() ); KeyedSqmFunctionDescriptors functionDescriptors; if ( useSTGeometry ) { diff --git a/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/postgis/PostgisDialectContributor.java b/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/postgis/PostgisDialectContributor.java index ec8662fc2ba2..2550a5d66a4a 100644 --- a/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/postgis/PostgisDialectContributor.java +++ b/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/postgis/PostgisDialectContributor.java @@ -24,13 +24,13 @@ public PostgisDialectContributor(ServiceRegistry serviceRegistry) { @Override public void contributeJdbcTypes(TypeContributions typeContributions) { - HSMessageLogger.LOGGER.typeContributions( this.getClass().getCanonicalName() ); + HSMessageLogger.SPATIAL_MSG_LOGGER.typeContributions( this.getClass().getCanonicalName() ); typeContributions.contributeJdbcType( PGGeometryJdbcType.INSTANCE_WKB_2 ); } @Override public void contributeFunctions(FunctionContributions functionContributions) { - HSMessageLogger.LOGGER.functionContributions( this.getClass().getCanonicalName() ); + HSMessageLogger.SPATIAL_MSG_LOGGER.functionContributions( this.getClass().getCanonicalName() ); final PostgisSqmFunctionDescriptors postgisFunctions = new PostgisSqmFunctionDescriptors( functionContributions ); final SqmFunctionRegistry functionRegistry = functionContributions.getFunctionRegistry(); postgisFunctions.asMap().forEach( (key, desc) -> { diff --git a/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/sqlserver/SqlServerDialectContributor.java b/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/sqlserver/SqlServerDialectContributor.java index b7f9f9a6e214..1e93cfe6802c 100644 --- a/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/sqlserver/SqlServerDialectContributor.java +++ b/hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/sqlserver/SqlServerDialectContributor.java @@ -23,13 +23,13 @@ public SqlServerDialectContributor(ServiceRegistry serviceRegistry) { @Override public void contributeJdbcTypes(TypeContributions typeContributions) { - HSMessageLogger.LOGGER.typeContributions( this.getClass().getCanonicalName() ); + HSMessageLogger.SPATIAL_MSG_LOGGER.typeContributions( this.getClass().getCanonicalName() ); typeContributions.contributeJdbcType( SqlServerGeometryType.INSTANCE ); } @Override public void contributeFunctions(FunctionContributions functionContributions) { - HSMessageLogger.LOGGER.functionContributions( this.getClass().getCanonicalName() ); + HSMessageLogger.SPATIAL_MSG_LOGGER.functionContributions( this.getClass().getCanonicalName() ); final SqlServerSqmFunctionDescriptors functions = new SqlServerSqmFunctionDescriptors( functionContributions ); final SqmFunctionRegistry functionRegistry = functionContributions.getFunctionRegistry(); functions.asMap().forEach( (key, desc) -> {