Skip to content

Commit

Permalink
logging report
Browse files Browse the repository at this point in the history
  • Loading branch information
sebersole committed Mar 11, 2022
1 parent 7a1d6f1 commit 741b6b7
Show file tree
Hide file tree
Showing 85 changed files with 1,028 additions and 532 deletions.
146 changes: 23 additions & 123 deletions design/logger_id_ranges.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
|<<ConnectionPoolingLogger>>
|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
| <<connections-pooling>>

|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

|===
2 changes: 2 additions & 0 deletions documentation/documentation.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ task renderMigrationGuide(type: AsciidoctorTask, group: 'Documentation') {task->
}
}

tasks.buildDocsForPublishing.dependsOn generateHibernateReports

tasks.withType(AsciidoctorTask).all {
baseDirFollowsSourceDir()
outputOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -112,21 +108,21 @@ public void configure(Map<String, Object> 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 );
}
}

Expand Down Expand Up @@ -187,12 +183,12 @@ public void configure(Map<String, Object> 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
Expand Down Expand Up @@ -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
Expand All @@ -229,7 +225,7 @@ public void stop() {
DataSources.destroy( ds );
}
catch (SQLException sqle) {
LOG.unableToDestroyC3p0ConnectionPool( sqle );
C3P0_MSG_LOGGER.unableToDestroyC3p0ConnectionPool( sqle );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
26 changes: 11 additions & 15 deletions hibernate-core/src/main/java/org/hibernate/boot/BootLogging.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Loading

0 comments on commit 741b6b7

Please sign in to comment.