Clean up test logging (hibernate-core)
This commit is contained in:
parent
7dc70e9350
commit
9028adc30e
|
@ -3,66 +3,77 @@
|
|||
#
|
||||
# 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>.
|
||||
#
|
||||
appender.stdout.type=Console
|
||||
|
||||
# Normal STDOUT appender
|
||||
appender.stdout.name=STDOUT
|
||||
appender.stdout.type=Console
|
||||
appender.stdout.layout.type=PatternLayout
|
||||
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
|
||||
|
||||
appender.unclosedSessionFactoryFile.type=File
|
||||
appender.unclosedSessionFactoryFile.name=unclosedSessionFactoryFile
|
||||
appender.unclosedSessionFactoryFile.append=true
|
||||
appender.unclosedSessionFactoryFile.fileName=target/tmp/log/UnclosedSessionFactoryWarnings.log
|
||||
appender.unclosedSessionFactoryFile.layout.type=PatternLayout
|
||||
appender.unclosedSessionFactoryFile.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
|
||||
|
||||
appender.ddl.type=Console
|
||||
appender.ddl.name=DDL
|
||||
appender.ddl.layout.type=PatternLayout
|
||||
appender.ddl.layout.pattern=%d{ABSOLUTE} %5p %c:%L - %m%n
|
||||
appender.subsystem.name=subsystem
|
||||
appender.subsystem.type=Console
|
||||
appender.subsystem.layout.type=PatternLayout
|
||||
appender.subsystem.layout.pattern=%d{ABSOLUTE} %5p %15.25c{5} %C{1}:%L - %m%n
|
||||
|
||||
rootLogger.level=info
|
||||
rootLogger.appenderRef.stdout.ref=STDOUT
|
||||
|
||||
# SQL Logging - HHH-6833
|
||||
logger.sql.name=org.hibernate.SQL
|
||||
logger.sql.level=debug
|
||||
|
||||
|
||||
###############################################################################
|
||||
# sub-system based logging
|
||||
|
||||
logger.jdbc-bind.name=org.hibernate.orm.jdbc.bind
|
||||
logger.jdbc-bind.appenderRef.subsystem.ref=subsystem
|
||||
logger.jdbc-bind.level=trace
|
||||
|
||||
logger.jdbc-extract.name=org.hibernate.orm.jdbc.extract
|
||||
logger.jdbc-extract.appenderRef.subsystem.ref=subsystem
|
||||
logger.jdbc-extract.level=trace
|
||||
|
||||
logger.graph.name=org.hibernate.orm.graph
|
||||
logger.graph.level=debug
|
||||
logger.graph.appenderRef.subsystem.ref=subsystem
|
||||
|
||||
## Hibernate's JUnit extensions (hibernate-testing)
|
||||
## - set to DEBUG or TRACE to see additional details
|
||||
## from those extensions
|
||||
logger.junit.name=org.hibernate.testing.orm.junit
|
||||
logger.junit.appenderRef.subsystem.ref=subsystem
|
||||
#logger.junit.level=debug
|
||||
|
||||
logger.tooling-schema-script.name=org.hibernate.orm.tooling.schema.script
|
||||
logger.tooling-schema-script.appenderRef.subsystem.ref=subsystem
|
||||
#logger.tooling-schema-script.level=trace
|
||||
|
||||
logger.tooling-schema-script-graph.name=org.hibernate.orm.tooling.schema.script.graph
|
||||
logger.tooling-schema-script-graph.appenderRef.subsystem.ref=subsystem
|
||||
#logger.tooling-schema-script-graph.level=trace
|
||||
|
||||
|
||||
logger.sql-result-graph.name=org.hibernate.orm.sql.results
|
||||
logger.sql-result-graph.appenderRef.subsystem.ref=subsystem
|
||||
logger.sql-result-graph.level=debug
|
||||
|
||||
## Logs every SQM tree
|
||||
logger.sqm-tree.name=org.hibernate.orm.query.sqm.ast
|
||||
logger.sqm-tree.appenderRef.subsystem.ref=subsystem
|
||||
#logger.sqm-tree.level=debug
|
||||
|
||||
|
||||
|
||||
###############################################################################
|
||||
# package/class name based logging
|
||||
|
||||
logger.hbm2ddl.name=org.hibernate.tool.hbm2ddl
|
||||
#logger.hbm2ddl.level=trace
|
||||
|
||||
logger.testing-cache.name=org.hibernate.testing.cache
|
||||
#logger.testing-cache.level=debug
|
||||
|
||||
# SQL Logging - HHH-6833
|
||||
logger.sql.name=org.hibernate.SQL
|
||||
logger.sql.level=debug
|
||||
|
||||
logger.type-basic-binder.name=org.hibernate.type.descriptor.jdbc.BasicBinder
|
||||
logger.type-basic-binder.level=trace
|
||||
logger.type-basic-extractor.name=org.hibernate.type.descriptor.jdbc.BasicExtractor
|
||||
logger.type-basic-extractor.level=trace
|
||||
|
||||
logger.jdbc-bind.name=org.hibernate.orm.jdbc.bind
|
||||
logger.jdbc-bind.level=trace
|
||||
|
||||
logger.jdbc-extract.name=org.hibernate.orm.jdbc.extract
|
||||
logger.jdbc-extract.level=trace
|
||||
|
||||
logger.hql-internal-ast.name=org.hibernate.hql.internal.ast
|
||||
logger.hql-internal-ast.level=debug
|
||||
|
||||
|
@ -99,9 +110,6 @@ logger.merged-entity-copies.name=org.hibernate.event.internal.EntityCopyAllowedL
|
|||
### provide information about merged entity copies.
|
||||
#logger.merged-entity-copies.level=debug
|
||||
|
||||
logger.test-class-metadata.name=org.hibernate.testing.junit4.TestClassMetadata
|
||||
logger.test-class-metadata.level=info
|
||||
logger.test-class-metadata.appenderRef.unclosedSessionFactoryFile.ref=unclosedSessionFactoryFile
|
||||
logger.scanning-coordinator.name=org.hibernate.boot.model.process.internal.ScanningCoordinator
|
||||
logger.scanning-coordinator.level=debug
|
||||
logger.abstract-persistent-collection.name=org.hibernate.collection.internal.AbstractPersistentCollection
|
||||
|
@ -111,3 +119,16 @@ logger.cache.name=org.hibernate.cache
|
|||
logger.cache.level=trace
|
||||
logger.stat.name=org.hibernate.stat
|
||||
logger.stat.level=trace
|
||||
|
||||
|
||||
# Specialized handling for tracking unclosed Session/SessionFactory resources as part of testing
|
||||
appender.unclosedSessionFactoryFile.type=File
|
||||
appender.unclosedSessionFactoryFile.name=unclosedSessionFactoryFile
|
||||
appender.unclosedSessionFactoryFile.append=true
|
||||
appender.unclosedSessionFactoryFile.fileName=target/tmp/log/UnclosedSessionFactoryWarnings.log
|
||||
appender.unclosedSessionFactoryFile.layout.type=PatternLayout
|
||||
appender.unclosedSessionFactoryFile.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
|
||||
|
||||
logger.unclosedTestFixtures.name=org.hibernate.orm.testing.resources
|
||||
logger.unclosedTestFixtures.level=info
|
||||
logger.unclosedTestFixtures.appenderRef.unclosedSessionFactoryFile.ref=unclosedSessionFactoryFile
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.hibernate.testing.AfterClassOnce;
|
|||
import org.hibernate.testing.BeforeClassOnce;
|
||||
import org.hibernate.testing.OnExpectedFailure;
|
||||
import org.hibernate.testing.OnFailure;
|
||||
import org.hibernate.testing.orm.UnclosedFixtureResourcesLogging;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
|
@ -29,9 +30,6 @@ import org.jboss.logging.Logger;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class TestClassMetadata {
|
||||
|
||||
private static final Logger log = Logger.getLogger( TestClassMetadata.class );
|
||||
|
||||
private static final Object[] NO_ARGS = new Object[0];
|
||||
private final Class testClass;
|
||||
|
||||
|
@ -170,7 +168,7 @@ public class TestClassMetadata {
|
|||
|
||||
public void performBeforeClassCallbacks(Object target) {
|
||||
if ( SessionFactoryRegistry.INSTANCE.hasRegistrations() ) {
|
||||
log.warnf( "Open SessionFactory instances found prior to start of test class [%s]", testClass.getName() );
|
||||
UnclosedFixtureResourcesLogging.LOGGER.warnf( "Open SessionFactory instances found prior to start of test class [%s]", testClass.getName() );
|
||||
}
|
||||
performCallbacks( beforeClassOnceMethods, target );
|
||||
}
|
||||
|
@ -215,7 +213,7 @@ public class TestClassMetadata {
|
|||
public void performAfterClassCallbacks(Object target) {
|
||||
performCallbacks( afterClassOnceMethods, target );
|
||||
if ( SessionFactoryRegistry.INSTANCE.hasRegistrations() ) {
|
||||
log.warnf( "Open SessionFactory instances found after completion of test class [%s]; closing them", testClass.getName() );
|
||||
UnclosedFixtureResourcesLogging.LOGGER.warnf( "Open SessionFactory instances found after completion of test class [%s]; closing them", testClass.getName() );
|
||||
SessionFactoryRegistry.INSTANCE.clearRegistrations();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* 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.testing.orm;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
public class UnclosedFixtureResourcesLogging {
|
||||
public static final Logger LOGGER = Logger.getLogger( "org.hibernate.orm.testing.resources" );
|
||||
}
|
Loading…
Reference in New Issue