HHH-14635 Upgrade to log4j 2

This commit is contained in:
Yoann Rodière 2021-05-25 12:46:19 +02:00 committed by Sanne Grinovero
parent a396c89322
commit 367ec2f276
43 changed files with 904 additions and 694 deletions

View File

@ -59,7 +59,6 @@
<bundle>mvn:com.fasterxml/classmate/0.8.0</bundle> <bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
<bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle> <bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle>
<bundle>mvn:log4j/log4j/1.2.17</bundle>
<bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle> <bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle>
<bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle> <bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>

View File

@ -32,7 +32,6 @@
<bundle>mvn:com.fasterxml/classmate/0.8.0</bundle> <bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
<bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle> <bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle>
<bundle>mvn:log4j/log4j/1.2.17</bundle>
<bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle> <bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle>
<bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle> <bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>

View File

@ -40,7 +40,6 @@
<bundle>mvn:com.fasterxml/classmate/0.8.0</bundle> <bundle>mvn:com.fasterxml/classmate/0.8.0</bundle>
<bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle> <bundle>mvn:org.apache.logging.log4j/log4j-api/2.0</bundle>
<bundle>mvn:log4j/log4j/1.2.17</bundle>
<bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle> <bundle>mvn:org.jboss.logging/jboss-logging/3.2.1.Final</bundle>
<bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle> <bundle>mvn:org.javassist/javassist/3.18.1-GA</bundle>

View File

@ -1,56 +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>.
#
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info, stdout
log4j.logger.org.hibernate=info
#log4j.logger.org.hibernate=warn
log4j.logger.org.hibernate.ejb=info
log4j.logger.org.hibernate.ejb.packaging=info
log4j.logger.org.hibernate.reflection=info
#log4j.logger.org.hibernate.engine.Cascades=warn
#log4j.logger.org.hibernate.hql=warn
### log just the SQL
log4j.logger.org.hibernate.SQL=debug
### log JDBC bind parameters ###
log4j.logger.org.hibernate.type=trace
log4j.logger.org.hibernate.type.descriptor.sql=trace
log4j.logger.org.hibernate.id.enhanced.TableGenerator=trace
log4j.logger.org.hibernate.id.IdentifierGeneratorHelper=trace
log4j.logger.org.hibernate.persister.entity.AbstractEntityPersister=trace
log4j.logger.org.hibernate.loader.plan.exec.process.internal.EntityReferenceInitializerImpl=trace
### log schema export/update ###
log4j.logger.org.hibernate.tool.hbm2ddl=info
### log HQL parse trees
#log4j.logger.org.hibernate.hql=warn
### log cache activity ###
#log4j.logger.org.hibernate.cache=warn
### log JDBC resource acquisition
#log4j.logger.org.hibernate.jdbc=warn
### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
### When entity copy merge functionality is enabled using:
### hibernate.event.merge.entity_copy_observer=log, the following will
### provide information about merged entity copies.
#log4j.logger.org.hibernate.event.internal.EntityCopyAllowedLoggedObserver=warn
log4j.logger.org.hibernate.userguide=debug

View File

@ -0,0 +1,75 @@
#
# 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>.
#
appender.stdout.type=Console
appender.stdout.name=STDOUT
appender.stdout.layout.type=PatternLayout
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
logger.hibernate.name=org.hibernate
logger.hibernate.level=info
#logger.hibernate.level=warn
logger.ejb.name=org.hibernate.ejb
logger.ejb.level=info
logger.ejb-packaging.name=org.hibernate.ejb.packaging
logger.ejb-packaging.level=info
logger.reflection.name=org.hibernate.reflection
logger.reflection.level=info
logger.cascades.name=org.hibernate.engine.Cascades
#logger.cascades.level=warn
### log just the SQL
logger.sql.name=org.hibernate.SQL
logger.sql.level=debug
### log JDBC bind parameters ###
logger.hibernate-type.name=org.hibernate.type
logger.hibernate-type.level=trace
logger.type-sql.name=org.hibernate.type.descriptor.sql
logger.type-sql.level=trace
logger.table-generator.name=org.hibernate.id.enhanced.TableGenerator
logger.table-generator.level=trace
logger.identifier-generator-helper.name=org.hibernate.id.IdentifierGeneratorHelper
logger.identifier-generator-helper.level=trace
logger.abstract-entity-persister.name=org.hibernate.persister.entity.AbstractEntityPersister
logger.abstract-entity-persister.level=trace
logger.entity-reference-initializer-impl.name=org.hibernate.loader.plan.exec.process.internal.EntityReferenceInitializerImpl
logger.entity-reference-initializer-impl.level=trace
### log schema export/update ###
logger.hbm2ddl.name=org.hibernate.tool.hbm2ddl
logger.hbm2ddl.level=info
### log HQL parse trees
logger.hql.name=org.hibernate.hql
#logger.hql.level=warn
### log cache activity ###
logger.cache.name=org.hibernate.cache
#logger.cache.level=warn
### log JDBC resource acquisition
logger.hibernate-jdbc.name=org.hibernate.jdbc
#logger.hibernate-jdbc.level=warn
### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
logger.driver-manager-connection-provider.name=org.hibernate.connection.DriverManagerConnectionProvider
#logger.driver-manager-connection-provider.level=trace
### When entity copy merge functionality is enabled using:
### hibernate.event.merge.entity_copy_observer=log, the following will
### provide information about merged entity copies.
logger.entity-copy-allowed-logged-observer.name=org.hibernate.event.internal.EntityCopyAllowedLoggedObserver
#logger.entity-copy-allowed-logged-observer.level=warn
logger.userguide.name=org.hibernate.userguide
logger.userguide.level=debug

View File

@ -1,54 +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>.
#
### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### direct messages to file hibernate.log ###
#log4j.appender.file=org.apache.log4j.FileAppender
#log4j.appender.file.File=hibernate.log
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### set log levels - for more verbose logging change 'info' to 'debug' ###
log4j.rootLogger=warn, stdout
#log4j.logger.org.hibernate=info
log4j.logger.org.hibernate=debug
### log HQL query parser activity
#log4j.logger.org.hibernate.hql.ast.AST=debug
### log just the SQL
#log4j.logger.org.hibernate.SQL=debug
### log JDBC bind parameters ###
log4j.logger.org.hibernate.type=info
#log4j.logger.org.hibernate.type=debug
### log schema export/update ###
log4j.logger.org.hibernate.tool.hbm2ddl=debug
### log HQL parse trees
#log4j.logger.org.hibernate.hql=debug
### log cache activity ###
#log4j.logger.org.hibernate.cache=debug
### log transaction activity
#log4j.logger.org.hibernate.transaction=debug
### log JDBC resource acquisition
#log4j.logger.org.hibernate.jdbc=debug
### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace

66
etc/log4j2.properties Normal file
View File

@ -0,0 +1,66 @@
#
# 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>.
#
### direct log messages to stdout ###
appender.stdout.type=Console
appender.stdout.name=STDOUT
appender.stdout.layout.type=PatternLayout
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### direct messages to file hibernate.log ###
#appender.file.type=File
#appender.file.name=file
#appender.file.fileName=hibernate.log
#appender.file.layout.type=PatternLayout
#appender.file.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### set log levels - for more verbose logging change 'info' to 'debug' ###
rootLogger.level=warn
rootLogger.appenderRef.stdout.ref=STDOUT
logger.hibernate.name=org.hibernate
#logger.hibernate.level=info
logger.hibernate.level=debug
### log HQL query parser activity
logger.hql-ast.name=org.hibernate.hql.ast.AST
#logger.hql-ast.level=debug
### log just the SQL
logger.sql.name=org.hibernate.SQL
#logger.sql.level=debug
### log JDBC bind parameters ###
logger.hibernate-type.name=org.hibernate.type
logger.hibernate-type.level=info
#logger.hibernate-type.level=debug
### log schema export/update ###
logger.hbm2ddl.name=org.hibernate.tool.hbm2ddl
logger.hbm2ddl.level=debug
### log HQL parse trees
logger.hql.name=org.hibernate.hql
#logger.hql.level=debug
### log cache activity ###
logger.cache.name=org.hibernate.cache
#logger.cache.level=debug
### log transaction activity
logger.hibernate-transaction.name=org.hibernate.transaction
#logger.hibernate-transaction.level=debug
### log JDBC resource acquisition
logger.hibernate-jdbc.name=org.hibernate.jdbc
#logger.hibernate-jdbc.level=debug
### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
logger.driver-manager-connection-provider.name=org.hibernate.connection.DriverManagerConnectionProvider
#logger.driver-manager-connection-provider.level=trace

View File

@ -71,7 +71,7 @@ dependencies {
testCompile( libraries.byteman_install ) testCompile( libraries.byteman_install )
testCompile( libraries.byteman_bmunit ) testCompile( libraries.byteman_bmunit )
testRuntime( libraries.log4j ) testRuntime( libraries.log4j2 )
testRuntime( libraries.javassist ) testRuntime( libraries.javassist )
testRuntime( libraries.byteBuddy ) testRuntime( libraries.byteBuddy )

View File

@ -101,7 +101,7 @@ ext {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~ testing // ~~~~~~~~~~~~~~~~~~~~~~~~~~ testing
log4j: "log4j:log4j:1.2.17", log4j2: "org.apache.logging.log4j:log4j-core:2.14.1",
junit: "junit:junit:${junitVersion}", junit: "junit:junit:${junitVersion}",
byteman: "org.jboss.byteman:byteman:${bytemanVersion}", byteman: "org.jboss.byteman:byteman:${bytemanVersion}",
byteman_install: "org.jboss.byteman:byteman-install:${bytemanVersion}", byteman_install: "org.jboss.byteman:byteman-install:${bytemanVersion}",

View File

@ -1,60 +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>.
#
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
#log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L (hibernateLoadPlanWalkPath->%X{hibernateLoadPlanWalkPath}) - %m%n
#log4j.appender.stdout-mdc=org.apache.log4j.ConsoleAppender
#log4j.appender.stdout-mdc.Target=System.out
#log4j.appender.stdout-mdc.layout=org.apache.log4j.PatternLayout
#log4j.appender.stdout-mdc.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L (walk path -> %X{hibernateLoadPlanWalkPath}) - %m%n
log4j.appender.unclosedSessionFactoryFile=org.apache.log4j.FileAppender
log4j.appender.unclosedSessionFactoryFile.append=true
log4j.appender.unclosedSessionFactoryFile.file=target/tmp/log/UnclosedSessionFactoryWarnings.log
log4j.appender.unclosedSessionFactoryFile.layout=org.apache.log4j.PatternLayout
log4j.appender.unclosedSessionFactoryFile.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info, stdout
#log4j.logger.org.hibernate.loader.plan=trace, stdout-mdc
#log4j.additivity.org.hibernate.loader.plan=false
#log4j.logger.org.hibernate.persister.walking=trace, stdout-mdc
#log4j.additivity.org.hibernate.persister.walking=false
log4j.logger.org.hibernate.tool.hbm2ddl=trace
log4j.logger.org.hibernate.testing.cache=debug
# SQL Logging - HHH-6833
log4j.logger.org.hibernate.SQL=debug
log4j.logger.org.hibernate.type.descriptor.sql.BasicBinder=trace
log4j.logger.org.hibernate.type.descriptor.sql.BasicExtractor=trace
log4j.logger.org.hibernate.hql.internal.ast=debug
log4j.logger.org.hibernate.sql.ordering.antlr=debug
log4j.logger.org.hibernate.loader.plan2.build.internal.LoadPlanImpl=debug
log4j.logger.org.hibernate.loader.plan2.build.spi.LoadPlanTreePrinter=debug
log4j.logger.org.hibernate.loader.plan2.exec.spi.EntityLoadQueryDetails=debug
log4j.logger.org.hibernate.engine.internal.StatisticalLoggingSessionEventListener=info
log4j.logger.org.hibernate.boot.model.source.internal.hbm.ModelBinder=debug
log4j.logger.org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry=debug
### When entity copy merge functionality is enabled using:
### hibernate.event.merge.entity_copy_observer=log, the following will
### provide information about merged entity copies.
### log4j.logger.org.hibernate.event.internal.EntityCopyAllowedLoggedObserver=debug
log4j.logger.org.hibernate.testing.junit4.TestClassMetadata=info, unclosedSessionFactoryFile
log4j.logger.org.hibernate.boot.model.process.internal.ScanningCoordinator=debug

View File

@ -0,0 +1,83 @@
#
# 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>.
#
appender.stdout.type=Console
appender.stdout.name=STDOUT
appender.stdout.layout.type=PatternLayout
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L (hibernateLoadPlanWalkPath->%X{hibernateLoadPlanWalkPath}) - %m%n
appender.stdout-mdc.type=Console
appender.stdout-mdc.name=stdout-mdc
appender.stdout-mdc.layout.type=PatternLayout
appender.stdout-mdc.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L (walk path -> %X{hibernateLoadPlanWalkPath}) - %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
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
logger.loader-plan.name=org.hibernate.loader.plan
#logger.loader-plan.level=trace
#logger.loader-plan.appenderRef.stdout-mdc.ref=stdout-mdc
#logger.loader-plan.additivity=false
logger.persister-walking.name=org.hibernate.persister.walking
#logger.persister-walking.level=trace
#logger.persister-walking.appenderRef.stdout-mdc.ref=stdout-mdc
#logger.persister-walking.additivity=false
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.sql.BasicBinder
logger.type-basic-binder.level=trace
logger.type-basic-extractor.name=org.hibernate.type.descriptor.sql.BasicExtractor
logger.type-basic-extractor.level=trace
logger.hql-internal-ast.name=org.hibernate.hql.internal.ast
logger.hql-internal-ast.level=debug
logger.sql-ordering-antlr.name=org.hibernate.sql.ordering.antlr
logger.sql-ordering-antlr.level=debug
logger.load-plan-impl.name=org.hibernate.loader.plan2.build.internal.LoadPlanImpl
logger.load-plan-impl.level=debug
logger.load-plan-tree-printer.name=org.hibernate.loader.plan2.build.spi.LoadPlanTreePrinter
logger.load-plan-tree-printer.level=debug
logger.entity-load-query-details.name=org.hibernate.loader.plan2.exec.spi.EntityLoadQueryDetails
logger.entity-load-query-details.level=debug
logger.statistical-logging-session-event-listener.name=org.hibernate.engine.internal.StatisticalLoggingSessionEventListener
logger.statistical-logging-session-event-listener.level=info
logger.model-binder.name=org.hibernate.boot.model.source.internal.hbm.ModelBinder
logger.model-binder.level=debug
logger.java-type-descriptor-registry.name=org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry
logger.java-type-descriptor-registry.level=debug
logger.merged-entity-copies.name=org.hibernate.event.internal.EntityCopyAllowedLoggedObserver
### When entity copy merge functionality is enabled using:
### hibernate.event.merge.entity_copy_observer=log, the following will
### 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

View File

@ -1,16 +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>.
#
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info, stdout
log4j.logger.org.hibernate.tool.hbm2ddl=debug
log4j.logger.org.hibernate.testing.cache=debug

View File

@ -0,0 +1,19 @@
#
# 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>.
#
appender.stdout.type=Console
appender.stdout.name=STDOUT
appender.stdout.layout.type=PatternLayout
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
logger.hbm2ddl.name=org.hibernate.tool.hbm2ddl
logger.hbm2ddl.level=debug
logger.testing-cache.name=org.hibernate.testing.cache
logger.testing-cache.level=debug

View File

@ -25,14 +25,17 @@ import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.Table; import javax.persistence.Table;
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.AvailableSettings;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.LoggerConfig;
@TestForIssue(jiraKey = "HHH-13244") @TestForIssue(jiraKey = "HHH-13244")
public class JpaProxyComplianceWithDebug extends BaseEntityManagerFunctionalTestCase { public class JpaProxyComplianceWithDebug extends BaseEntityManagerFunctionalTestCase {
@ -82,17 +85,19 @@ public class JpaProxyComplianceWithDebug extends BaseEntityManagerFunctionalTest
@Test @Test
@TestForIssue(jiraKey = "HHH-13244") @TestForIssue(jiraKey = "HHH-13244")
public void testJpaComplianceProxyWithDebug() { public void testJpaComplianceProxyWithDebug() {
LoggerContext context = (LoggerContext) LogManager.getContext( false );
Configuration configuration = context.getConfiguration();
//This could be replaced with setting the root logger level, or the "org.hibernate" logger to debug. //This could be replaced with setting the root logger level, or the "org.hibernate" logger to debug.
//These are simply the narrowest log settings that trigger the bug //These are simply the narrowest log settings that trigger the bug
Logger entityLogger = LogManager.getLogger("org.hibernate.internal.util.EntityPrinter"); LoggerConfig entityLogger = configuration.getLoggerConfig( "org.hibernate.internal.util.EntityPrinter");
Logger listenerLogger = LogManager.getLogger("org.hibernate.event.internal.AbstractFlushingEventListener"); LoggerConfig listenerLogger = configuration.getLoggerConfig("org.hibernate.event.internal.AbstractFlushingEventListener");
Level oldEntityLogLevel = entityLogger.getLevel(); Level oldEntityLogLevel = entityLogger.getLevel();
Level oldListenerLogLevel = listenerLogger.getLevel(); Level oldListenerLogLevel = listenerLogger.getLevel();
entityLogger.setLevel((Level) Level.DEBUG); entityLogger.setLevel(Level.DEBUG);
listenerLogger.setLevel((Level) Level.DEBUG); listenerLogger.setLevel(Level.DEBUG);
try { try {
doInJPA(this::entityManagerFactory, entityManager -> { doInJPA(this::entityManagerFactory, entityManager -> {
entityManager.find(MvnoBillingAgreement.class, 1); entityManager.find(MvnoBillingAgreement.class, 1);

View File

@ -132,8 +132,10 @@ public class ImmutableNaturalKeyLookupTest extends BaseCoreFunctionalTestCase {
newTx = s.beginTransaction(); newTx = s.beginTransaction();
// please enable // please enable
// log4j.logger.org.hibernate.cache.StandardQueryCache=DEBUG // logger.standard-query-cache.name=org.hibernate.cache.StandardQueryCache
// log4j.logger.org.hibernate.cache.UpdateTimestampsCache=DEBUG // logger.standard-query-cache.level=debug
// logger.update-timestamps-cache.name=org.hibernate.cache.UpdateTimestampsCache
// logger.update-timestamps-cache.level=debug
// to see that isUpToDate is called where not appropriated // to see that isUpToDate is called where not appropriated
Assert.assertTrue( s.getSessionFactory().getStatistics().isStatisticsEnabled() ); Assert.assertTrue( s.getSessionFactory().getStatistics().isStatisticsEnabled() );
@ -228,8 +230,10 @@ public class ImmutableNaturalKeyLookupTest extends BaseCoreFunctionalTestCase {
newTx = s.beginTransaction(); newTx = s.beginTransaction();
// please enable // please enable
// log4j.logger.org.hibernate.cache.StandardQueryCache=DEBUG // logger.standard-query-cache.name=org.hibernate.cache.StandardQueryCache
// log4j.logger.org.hibernate.cache.UpdateTimestampsCache=DEBUG // logger.standard-query-cache.level=debug
// logger.update-timestamps-cache.name=org.hibernate.cache.UpdateTimestampsCache
// logger.update-timestamps-cache.level=debug
// to see that isUpToDate is called where not appropriated // to see that isUpToDate is called where not appropriated
Assert.assertTrue( s.getSessionFactory().getStatistics().isStatisticsEnabled() ); Assert.assertTrue( s.getSessionFactory().getStatistics().isStatisticsEnabled() );
@ -274,8 +278,10 @@ public class ImmutableNaturalKeyLookupTest extends BaseCoreFunctionalTestCase {
newTx = s.beginTransaction(); newTx = s.beginTransaction();
// please enable // please enable
// log4j.logger.org.hibernate.cache.StandardQueryCache=DEBUG // logger.standard-query-cache.name=org.hibernate.cache.StandardQueryCache
// log4j.logger.org.hibernate.cache.UpdateTimestampsCache=DEBUG // logger.standard-query-cache.level=debug
// logger.update-timestamps-cache.name=org.hibernate.cache.UpdateTimestampsCache
// logger.update-timestamps-cache.level=debug
// to see that isUpToDate is called where not appropriated // to see that isUpToDate is called where not appropriated
Assert.assertTrue( s.getSessionFactory().getStatistics().isStatisticsEnabled() ); Assert.assertTrue( s.getSessionFactory().getStatistics().isStatisticsEnabled() );

View File

@ -32,10 +32,6 @@ import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test; import org.junit.Test;
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
/** /**

View File

@ -15,8 +15,6 @@ import javax.persistence.Table;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger;
import org.hibernate.annotations.ForeignKey; import org.hibernate.annotations.ForeignKey;
import org.hibernate.boot.MetadataSources; import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistry;
@ -26,6 +24,7 @@ import org.hibernate.tool.schema.internal.SchemaCreatorImpl;
import org.junit.Test; import org.junit.Test;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.jboss.logging.Logger;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;

View File

@ -1,66 +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>.
#
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
#log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L (hibernateLoadPlanWalkPath->%X{hibernateLoadPlanWalkPath}) - %m%n
#log4j.appender.stdout-mdc=org.apache.log4j.ConsoleAppender
#log4j.appender.stdout-mdc.Target=System.out
#log4j.appender.stdout-mdc.layout=org.apache.log4j.PatternLayout
#log4j.appender.stdout-mdc.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L (walk path -> %X{hibernateLoadPlanWalkPath}) - %m%n
log4j.appender.unclosedSessionFactoryFile=org.apache.log4j.FileAppender
log4j.appender.unclosedSessionFactoryFile.append=true
log4j.appender.unclosedSessionFactoryFile.file=target/tmp/log/UnclosedSessionFactoryWarnings.log
log4j.appender.unclosedSessionFactoryFile.layout=org.apache.log4j.PatternLayout
log4j.appender.unclosedSessionFactoryFile.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info, stdout
#log4j.logger.org.hibernate.loader.plan=trace, stdout-mdc
#log4j.additivity.org.hibernate.loader.plan=false
#log4j.logger.org.hibernate.persister.walking=trace, stdout-mdc
#log4j.additivity.org.hibernate.persister.walking=false
log4j.logger.org.hibernate.tool.hbm2ddl=trace
log4j.logger.org.hibernate.testing.cache=debug
# SQL Logging - HHH-6833
log4j.logger.org.hibernate.SQL=debug
log4j.logger.org.hibernate.type.descriptor.sql.BasicBinder=trace
log4j.logger.org.hibernate.type.descriptor.sql.BasicExtractor=trace
log4j.logger.org.hibernate.hql.internal.ast=debug
log4j.logger.org.hibernate.sql.ordering.antlr=debug
log4j.logger.org.hibernate.loader.plan2.build.internal.LoadPlanImpl=debug
log4j.logger.org.hibernate.loader.plan2.build.spi.LoadPlanTreePrinter=debug
log4j.logger.org.hibernate.loader.plan2.exec.spi.EntityLoadQueryDetails=debug
log4j.logger.org.hibernate.engine.internal.StatisticalLoggingSessionEventListener=info
log4j.logger.org.hibernate.boot.model.source.internal.hbm.ModelBinder=debug
log4j.logger.org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry=debug
#log4j.logger.org.hibernate.action.internal.EntityAction=debug
#log4j.logger.org.hibernate.engine.internal.Cascade=trace
### When entity copy merge functionality is enabled using:
### hibernate.event.merge.entity_copy_observer=log, the following will
### provide information about merged entity copies.
### log4j.logger.org.hibernate.event.internal.EntityCopyAllowedLoggedObserver=debug
log4j.logger.org.hibernate.testing.junit4.TestClassMetadata=info, unclosedSessionFactoryFile
log4j.logger.org.hibernate.boot.model.process.internal.ScanningCoordinator=debug
log4j.logger.org.hibernate.collection.internal.AbstractPersistentCollection=debug
log4j.logger.org.hibernate.cache trace
log4j.logger.org.hibernate.stat trace

View File

@ -0,0 +1,89 @@
#
# 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>.
#
appender.stdout.type=Console
appender.stdout.name=STDOUT
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
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
logger.graph.name=org.hibernate.orm.graph
logger.graph.level=debug
logger.tooling-schema-script.name=org.hibernate.orm.tooling.schema.script
#logger.tooling-schema-script.level=trace
logger.tooling-schema-script-graph.name=org.hibernate.orm.tooling.schema.script.graph
#logger.tooling-schema-script-graph.level=trace
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.sql.BasicBinder
logger.type-basic-binder.level=trace
logger.type-basic-extractor.name=org.hibernate.type.descriptor.sql.BasicExtractor
logger.type-basic-extractor.level=trace
logger.hql-internal-ast.name=org.hibernate.hql.internal.ast
logger.hql-internal-ast.level=debug
logger.sql-ordering-antlr.name=org.hibernate.sql.ordering.antlr
logger.sql-ordering-antlr.level=debug
logger.load-plan-impl.name=org.hibernate.loader.plan2.build.internal.LoadPlanImpl
logger.load-plan-impl.level=debug
logger.load-plan-tree-printer.name=org.hibernate.loader.plan2.build.spi.LoadPlanTreePrinter
logger.load-plan-tree-printer.level=debug
logger.entity-load-query-details.name=org.hibernate.loader.plan2.exec.spi.EntityLoadQueryDetails
logger.entity-load-query-details.level=debug
logger.statistical-logging-session-event-listener.name=org.hibernate.engine.internal.StatisticalLoggingSessionEventListener
logger.statistical-logging-session-event-listener.level=info
logger.model-binder.name=org.hibernate.boot.model.source.internal.hbm.ModelBinder
logger.model-binder.level=debug
logger.java-type-descriptor-registry.name=org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry
logger.java-type-descriptor-registry.level=debug
logger.entity-action.name=org.hibernate.action.internal.EntityAction
#logger.entity-action.level=debug
logger.cascade.name=org.hibernate.engine.internal.Cascade
#logger.cascade.level=trace
logger.merged-entity-copies.name=org.hibernate.event.internal.EntityCopyAllowedLoggedObserver
### When entity copy merge functionality is enabled using:
### hibernate.event.merge.entity_copy_observer=log, the following will
### 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
logger.abstract-persistent-collection.level=debug
logger.cache.name=org.hibernate.cache
logger.cache.level=trace
logger.stat.name=org.hibernate.stat
logger.stat.level=trace

View File

@ -1,17 +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
#
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info, stdout
log4j.logger.org.hibernate.test=info
# SQL Logging - HHH-6833
log4j.logger.org.hibernate.SQL=debug

View File

@ -0,0 +1,20 @@
#
# 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
#
appender.stdout.type=Console
appender.stdout.name=STDOUT
appender.stdout.layout.type=PatternLayout
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
logger.test.name=org.hibernate.test
logger.test.level=info
# SQL Logging - HHH-6833
logger.sql.name=org.hibernate.SQL
logger.sql.level=debug

View File

@ -1,23 +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>.
#
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info, stdout
log4j.logger.org.hibernate.test=info
# SQL Logging - HHH-6833
log4j.logger.org.hibernate.SQL=debug
log4j.logger.org.hibernate.tool.hbm2ddl=debug
log4j.logger.org.hibernate.type.descriptor.sql.BasicBinder=trace
log4j.logger.org.hibernate.type.descriptor.sql.BasicExtractor=trace
log4j.logger.org.hibernate.envers.boot.internal.AdditionalJaxbMappingProducerImpl=trace

View File

@ -0,0 +1,30 @@
#
# 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>.
#
appender.stdout.type=Console
appender.stdout.name=STDOUT
appender.stdout.layout.type=PatternLayout
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
logger.test.name=org.hibernate.test
logger.test.level=info
# SQL Logging - HHH-6833
logger.sql.name=org.hibernate.SQL
logger.sql.level=debug
logger.hbm2ddl.name=org.hibernate.tool.hbm2ddl
logger.hbm2ddl.level=debug
logger.type-basic-binder.name=org.hibernate.type.descriptor.sql.BasicBinder
logger.type-basic-binder.level=trace
logger.type-basic-extractor.name=org.hibernate.type.descriptor.sql.BasicExtractor
logger.type-basic-extractor.level=trace
logger.additional-jaxb-mapping-producer-impl.name=org.hibernate.envers.boot.internal.AdditionalJaxbMappingProducerImpl
logger.additional-jaxb-mapping-producer-impl.level=trace

View File

@ -1,60 +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>.
#
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
#log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L (hibernateLoadPlanWalkPath->%X{hibernateLoadPlanWalkPath}) - %m%n
#log4j.appender.stdout-mdc=org.apache.log4j.ConsoleAppender
#log4j.appender.stdout-mdc.Target=System.out
#log4j.appender.stdout-mdc.layout=org.apache.log4j.PatternLayout
#log4j.appender.stdout-mdc.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L (walk path -> %X{hibernateLoadPlanWalkPath}) - %m%n
log4j.appender.unclosedSessionFactoryFile=org.apache.log4j.FileAppender
log4j.appender.unclosedSessionFactoryFile.append=true
log4j.appender.unclosedSessionFactoryFile.file=target/tmp/log/UnclosedSessionFactoryWarnings.log
log4j.appender.unclosedSessionFactoryFile.layout=org.apache.log4j.PatternLayout
log4j.appender.unclosedSessionFactoryFile.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info, stdout
#log4j.logger.org.hibernate.loader.plan=trace, stdout-mdc
#log4j.additivity.org.hibernate.loader.plan=false
#log4j.logger.org.hibernate.persister.walking=trace, stdout-mdc
#log4j.additivity.org.hibernate.persister.walking=false
log4j.logger.org.hibernate.tool.hbm2ddl=trace
log4j.logger.org.hibernate.testing.cache=debug
# SQL Logging - HHH-6833
log4j.logger.org.hibernate.SQL=debug
log4j.logger.org.hibernate.type.descriptor.sql.BasicBinder=trace
log4j.logger.org.hibernate.type.descriptor.sql.BasicExtractor=trace
log4j.logger.org.hibernate.hql.internal.ast=debug
log4j.logger.org.hibernate.sql.ordering.antlr=debug
log4j.logger.org.hibernate.loader.plan2.build.internal.LoadPlanImpl=debug
log4j.logger.org.hibernate.loader.plan2.build.spi.LoadPlanTreePrinter=debug
log4j.logger.org.hibernate.loader.plan2.exec.spi.EntityLoadQueryDetails=debug
log4j.logger.org.hibernate.engine.internal.StatisticalLoggingSessionEventListener=info
log4j.logger.org.hibernate.boot.model.source.internal.hbm.ModelBinder=debug
log4j.logger.org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry=debug
### When entity copy merge functionality is enabled using:
### hibernate.event.merge.entity_copy_observer=log, the following will
### provide information about merged entity copies.
### log4j.logger.org.hibernate.event.internal.EntityCopyAllowedLoggedObserver=debug
log4j.logger.org.hibernate.testing.junit4.TestClassMetadata=info, unclosedSessionFactoryFile
log4j.logger.org.hibernate.boot.model.process.internal.ScanningCoordinator=debug

View File

@ -0,0 +1,83 @@
#
# 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>.
#
appender.stdout.type=Console
appender.stdout.name=STDOUT
appender.stdout.layout.type=PatternLayout
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L (hibernateLoadPlanWalkPath->%X{hibernateLoadPlanWalkPath}) - %m%n
appender.stdout-mdc.type=Console
appender.stdout-mdc.name=stdout-mdc
appender.stdout-mdc.layout.type=PatternLayout
appender.stdout-mdc.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L (walk path -> %X{hibernateLoadPlanWalkPath}) - %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
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
logger.loader-plan.name=org.hibernate.loader.plan
#logger.loader-plan.level=trace
#logger.loader-plan.appenderRef.stdout-mdc.ref=stdout-mdc
#logger.loader-plan.additivity=false
logger.persister-walking.name=org.hibernate.persister.walking
#logger.persister-walking.level=trace
#logger.persister-walking.appenderRef.stdout-mdc.ref=stdout-mdc
#logger.persister-walking.additivity=false
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.sql.BasicBinder
logger.type-basic-binder.level=trace
logger.type-basic-extractor.name=org.hibernate.type.descriptor.sql.BasicExtractor
logger.type-basic-extractor.level=trace
logger.hql-internal-ast.name=org.hibernate.hql.internal.ast
logger.hql-internal-ast.level=debug
logger.sql-ordering-antlr.name=org.hibernate.sql.ordering.antlr
logger.sql-ordering-antlr.level=debug
logger.load-plan-impl.name=org.hibernate.loader.plan2.build.internal.LoadPlanImpl
logger.load-plan-impl.level=debug
logger.load-plan-tree-printer.name=org.hibernate.loader.plan2.build.spi.LoadPlanTreePrinter
logger.load-plan-tree-printer.level=debug
logger.entity-load-query-details.name=org.hibernate.loader.plan2.exec.spi.EntityLoadQueryDetails
logger.entity-load-query-details.level=debug
logger.statistical-logging-session-event-listener.name=org.hibernate.engine.internal.StatisticalLoggingSessionEventListener
logger.statistical-logging-session-event-listener.level=info
logger.model-binder.name=org.hibernate.boot.model.source.internal.hbm.ModelBinder
logger.model-binder.level=debug
logger.java-type-descriptor-registry.name=org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry
logger.java-type-descriptor-registry.level=debug
logger.merged-entity-copies.name=org.hibernate.event.internal.EntityCopyAllowedLoggedObserver
### When entity copy merge functionality is enabled using:
### hibernate.event.merge.entity_copy_observer=log, the following will
### 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

View File

@ -1,17 +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>.
#
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info, stdout
log4j.logger.org.hibernate.test=info
# SQL Logging - HHH-6833
log4j.logger.org.hibernate.SQL=debug

View File

@ -0,0 +1,20 @@
#
# 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>.
#
appender.stdout.type=Console
appender.stdout.name=STDOUT
appender.stdout.layout.type=PatternLayout
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
logger.test.name=org.hibernate.test
logger.test.level=info
# SQL Logging - HHH-6833
logger.sql.name=org.hibernate.SQL
logger.sql.level=debug

View File

@ -0,0 +1,25 @@
#
# 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>.
#
appender.stdout.type=Console
appender.stdout.name=STDOUT
appender.stdout.layout.type=PatternLayout
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
logger.stat.name=org.hibernate.stat
logger.stat.level=trace
logger.hbm2ddl.name=org.hibernate.tool.hbm2ddl
logger.hbm2ddl.level=trace
logger.sql.name=org.hibernate.SQL
logger.sql.level=debug
logger.type-basic-binder.name=org.hibernate.type.descriptor.sql.BasicBinder
logger.type-basic-binder.level=trace
logger.type-basic-extractor.name=org.hibernate.type.descriptor.sql.BasicExtractor
logger.type-basic-extractor.level=trace

View File

@ -5,19 +5,19 @@
# See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. # See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
# #
# Root logger option
log4j.rootLogger=DEBUG, file
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=target/test.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p [%c] (%t) - %m%n
log4j.appender.file.Threshold=DEBUG
# Direct log messages to console # Direct log messages to console
log4j.appender.console=org.apache.log4j.ConsoleAppender appender.stdout.type=Console
log4j.appender.console.Target=System.out appender.stdout.name=STDOUT
log4j.appender.console.layout=org.apache.log4j.PatternLayout appender.stdout.layout.type=PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p [%c] (%t) - %m%n appender.stdout.layout.pattern=%d{yyyy-MM-dd HH:mm:ss} %-5p [%c] (%t) - %m%n
log4j.appender.console.Threshold=WARN
# Direct log messages to a log file
appender.file.type=File
appender.file.name=file
appender.file.fileName=target/test.log
appender.file.layout.type=PatternLayout
appender.file.layout.pattern=%d{yyyy-MM-dd HH:mm:ss} %-5p [%c] (%t) - %m%n
# Root logger option
rootLogger.level=debug
rootLogger.appenderRef.file.ref=file

View File

@ -1,16 +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>.
#
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info, stdout
log4j.logger.org.hibernate.tool.hbm2ddl=debug
log4j.logger.org.hibernate.testing.cache=debug

View File

@ -0,0 +1,19 @@
#
# 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>.
#
appender.stdout.type=Console
appender.stdout.name=STDOUT
appender.stdout.layout.type=PatternLayout
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
logger.hbm2ddl.name=org.hibernate.tool.hbm2ddl
logger.hbm2ddl.level=debug
logger.testing-cache.name=org.hibernate.testing.cache
logger.testing-cache.level=debug

View File

@ -1,16 +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>.
#
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info, stdout
log4j.logger.org.hibernate.SQL=DEBUG
log4j.logger.org.hibernate.spatial=debug

View File

@ -0,0 +1,16 @@
#
# 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>.
#
appender.stdout.type=Console
appender.stdout.name=STDOUT
appender.stdout.layout.type=PatternLayout
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
logger.sql.name=org.hibernate.SQL
logger.sql.level=DEBUG
logger.spatial.name=org.hibernate.spatial
logger.spatial.level=debug

View File

@ -18,7 +18,7 @@ dependencies {
compile( libraries.byteman_install ) compile( libraries.byteman_install )
compile( libraries.byteman_bmunit ) compile( libraries.byteman_bmunit )
compile( libraries.xapool ) compile( libraries.xapool )
compile( libraries.log4j ) compile( libraries.log4j2 )
compile ( libraries.jboss_jta ) { compile ( libraries.jboss_jta ) {
transitive=false; transitive=false;
} }

View File

@ -1,129 +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.testing.logger;
import java.text.MessageFormat;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import org.jboss.logging.Logger;
/**
* A {@code Logger} implementation which delegates to Log4J but makes it possible
* to test for events being logged (not logged).
*
* @author <a href="mailto:sanne@hibernate.org">Sanne Grinovero</a> (C) 2011 Red Hat Inc.
*/
public final class Log4DelegatingLogger extends Logger {
private final org.apache.log4j.Logger logger;
// Synchronize access on the field
private final List<LogListener> enabledListeners = new LinkedList<LogListener>();
private final AtomicBoolean interceptEnabled = new AtomicBoolean( false );
Log4DelegatingLogger(final String name) {
super( name );
logger = org.apache.log4j.Logger.getLogger( name );
}
void registerListener(LogListener newListener) {
synchronized ( enabledListeners ) {
if ( newListener != null ) {
enabledListeners.add( newListener );
interceptEnabled.set( true );
}
}
}
void clearAllListeners() {
synchronized ( enabledListeners ) {
enabledListeners.clear();
interceptEnabled.set( false );
}
}
public boolean isEnabled(final Level level) {
final org.apache.log4j.Level l = translate( level );
return logger.isEnabledFor( l ) && l.isGreaterOrEqual( logger.getEffectiveLevel() );
}
protected void doLog(final Level level, final String loggerClassName, final Object message, final Object[] parameters, final Throwable thrown) {
final org.apache.log4j.Level translatedLevel = translate( level );
if ( interceptEnabled.get() ) {
intercept( level, parameters == null || parameters.length == 0 ? String.valueOf( message ) : MessageFormat.format( String.valueOf( message ), parameters ), thrown );
}
if ( !logger.isEnabledFor( translatedLevel ) ) {
return;
}
try {
logger.log(
loggerClassName,
translatedLevel,
parameters == null || parameters.length == 0
? String.valueOf( message )
: MessageFormat.format(String.valueOf( message ), parameters ),
thrown
);
}
catch (Throwable ignored) {
}
}
private void intercept(Level level, String renderedMessage, Throwable thrown) {
synchronized ( enabledListeners ) {
for ( LogListener listener : enabledListeners ) {
listener.loggedEvent( level, renderedMessage, thrown );
}
}
}
protected void doLogf(final Level level, final String loggerClassName, final String format, final Object[] parameters, final Throwable thrown) {
final org.apache.log4j.Level translatedLevel = translate( level );
if ( interceptEnabled.get() ) {
intercept( level, parameters == null ? format : String.format( format, parameters ), thrown );
}
if ( !logger.isEnabledFor( translatedLevel ) ) {
return;
}
try {
logger.log(
loggerClassName,
translatedLevel,
parameters == null ? format : String.format( format, parameters ),
thrown
);
}
catch (Throwable ignored) {
}
}
private static org.apache.log4j.Level translate(final Level level) {
if ( level == null ) {
return org.apache.log4j.Level.ALL;
}
switch ( level ) {
case FATAL:
return org.apache.log4j.Level.FATAL;
case ERROR:
return org.apache.log4j.Level.ERROR;
case WARN:
return org.apache.log4j.Level.WARN;
case INFO:
return org.apache.log4j.Level.INFO;
case DEBUG:
return org.apache.log4j.Level.DEBUG;
case TRACE:
return org.apache.log4j.Level.TRACE;
}
return org.apache.log4j.Level.ALL;
}
}

View File

@ -0,0 +1,160 @@
/*
* 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.logger;
import java.text.MessageFormat;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import org.jboss.logging.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.LoggingException;
import org.apache.logging.log4j.message.MessageFormatMessageFactory;
import org.apache.logging.log4j.message.StringFormattedMessage;
import org.apache.logging.log4j.spi.AbstractLogger;
/**
* A {@code Logger} implementation which delegates to Log4J2 but makes it possible
* to test for events being logged (not logged).
*
* @author <a href="mailto:sanne@hibernate.org">Sanne Grinovero</a> (C) 2015 Red Hat Inc.
*/
public final class Log4J2DelegatingLogger extends Logger {
private final AbstractLogger logger;
private final MessageFormatMessageFactory messageFactory;
// Synchronize access on the field
private final List<LogListener> enabledListeners = new LinkedList<>();
private final AtomicBoolean interceptEnabled = new AtomicBoolean( false );
Log4J2DelegatingLogger(final String name) {
super( name );
org.apache.logging.log4j.Logger logger = LogManager.getLogger( name );
if ( !( logger instanceof AbstractLogger ) ) {
throw new LoggingException( "The logger for [" + name + "] does not extend AbstractLogger. Actual logger: " + logger
.getClass()
.getName() );
}
this.logger = (AbstractLogger) logger;
this.messageFactory = new MessageFormatMessageFactory();
}
void registerListener(LogListener newListener) {
synchronized (enabledListeners) {
if ( newListener != null ) {
enabledListeners.add( newListener );
interceptEnabled.set( true );
}
}
}
void clearAllListeners() {
synchronized (enabledListeners) {
enabledListeners.clear();
interceptEnabled.set( false );
}
}
@Override
public boolean isEnabled(final Level level) {
return this.logger.isEnabled( translate( level ) );
}
@Override
protected void doLog(
final Level level,
final String loggerClassName,
final Object message,
final Object[] parameters,
final Throwable thrown) {
final org.apache.logging.log4j.Level translatedLevel = translate( level );
if ( interceptEnabled.get() ) {
intercept(
level,
parameters == null || parameters.length == 0 ?
String.valueOf( message ) :
MessageFormat.format( String.valueOf( message ), parameters ),
thrown
);
}
if ( !this.logger.isEnabled( translatedLevel ) ) {
return;
}
try {
this.logger.logMessage( loggerClassName, translatedLevel, null,
( parameters == null || parameters.length == 0 ) ?
this.messageFactory.newMessage( message ) :
this.messageFactory.newMessage( String.valueOf( message ), parameters ),
thrown
);
}
catch (Throwable ignored) {
}
}
private void intercept(Level level, String renderedMessage, Throwable thrown) {
synchronized (enabledListeners) {
for ( LogListener listener : enabledListeners ) {
listener.loggedEvent( level, renderedMessage, thrown );
}
}
}
@Override
protected void doLogf(
final Level level,
final String loggerClassName,
final String format,
final Object[] parameters,
final Throwable thrown) {
final org.apache.logging.log4j.Level translatedLevel = translate( level );
if ( interceptEnabled.get() ) {
intercept( level, parameters == null ? format : String.format( format, parameters ), thrown );
}
if ( !logger.isEnabled( translatedLevel ) ) {
return;
}
try {
this.logger.logMessage(
loggerClassName,
translatedLevel,
null,
new StringFormattedMessage( format, parameters ),
thrown
);
}
catch (Throwable ignored) {
}
}
private static org.apache.logging.log4j.Level translate(final Level level) {
if ( level == null ) {
return org.apache.logging.log4j.Level.ALL;
}
switch ( level ) {
case FATAL:
return org.apache.logging.log4j.Level.FATAL;
case ERROR:
return org.apache.logging.log4j.Level.ERROR;
case WARN:
return org.apache.logging.log4j.Level.WARN;
case INFO:
return org.apache.logging.log4j.Level.INFO;
case DEBUG:
return org.apache.logging.log4j.Level.DEBUG;
case TRACE:
return org.apache.logging.log4j.Level.TRACE;
}
return org.apache.logging.log4j.Level.ALL;
}
}

View File

@ -32,7 +32,7 @@ final class LogInspectionHelper {
convertType( log ).clearAllListeners(); convertType( log ).clearAllListeners();
} }
private static Log4DelegatingLogger convertType(BasicLogger log) { private static Log4J2DelegatingLogger convertType(BasicLogger log) {
if ( log instanceof DelegatingBasicLogger) { if ( log instanceof DelegatingBasicLogger) {
//Most loggers generated via the annotation processor are of this type //Most loggers generated via the annotation processor are of this type
DelegatingBasicLogger wrapper = (DelegatingBasicLogger) log; DelegatingBasicLogger wrapper = (DelegatingBasicLogger) log;
@ -43,13 +43,13 @@ final class LogInspectionHelper {
throw new RuntimeException( cause ); throw new RuntimeException( cause );
} }
} }
if ( ! ( log instanceof Log4DelegatingLogger ) ) { if ( ! ( log instanceof Log4J2DelegatingLogger ) ) {
throw new AssertionFailure( "Unexpected log type: JBoss Logger didn't register the custom TestableLoggerProvider as logger provider" ); throw new AssertionFailure( "Unexpected log type: JBoss Logger didn't register the custom TestableLoggerProvider as logger provider" );
} }
return (Log4DelegatingLogger) log; return (Log4J2DelegatingLogger) log;
} }
private static Log4DelegatingLogger extractFromWrapper(DelegatingBasicLogger wrapper) throws Exception { private static Log4J2DelegatingLogger extractFromWrapper(DelegatingBasicLogger wrapper) throws Exception {
Field field = DelegatingBasicLogger.class.getDeclaredField( "log" ); Field field = DelegatingBasicLogger.class.getDeclaredField( "log" );
field.setAccessible( true ); field.setAccessible( true );
Object object = field.get( wrapper ); Object object = field.get( wrapper );

View File

@ -6,14 +6,15 @@
*/ */
package org.hibernate.testing.logger; package org.hibernate.testing.logger;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import org.apache.log4j.MDC;
import org.apache.log4j.NDC;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.apache.logging.log4j.ThreadContext;
/** /**
* A {@code LoggerProvider} for JBoss Logger. * A {@code LoggerProvider} for JBoss Logger.
* See also META-INF/services/org.jboss.logging.LoggerProvider * See also META-INF/services/org.jboss.logging.LoggerProvider
@ -23,17 +24,18 @@ import org.jboss.logging.Logger;
public class TestableLoggerProvider implements org.jboss.logging.LoggerProvider { public class TestableLoggerProvider implements org.jboss.logging.LoggerProvider {
//We LEAK Logger instances: good only for testing as we know the set of categories is limited in practice //We LEAK Logger instances: good only for testing as we know the set of categories is limited in practice
private static final ConcurrentMap<String,Logger> reuseLoggerInstances = new ConcurrentHashMap<String,Logger>(); private static final ConcurrentMap<String,Logger> reuseLoggerInstances = new ConcurrentHashMap<>();
// Maintainer note: // Maintainer note:
// Except the next method, which is adjusted to return our own Log4DelegatingLogger // Except the next method, which is adjusted to return our own Log4DelegatingLogger
// this class is a verbatim copy of org.jboss.logging.Log4jLoggerProvider // this class is a verbatim copy of org.jboss.logging.Log4jLoggerProvider
// (which is a final class) // (which is a final class)
@Override
public Logger getLogger(final String name) { public Logger getLogger(final String name) {
Logger logger = reuseLoggerInstances.get( name ); Logger logger = reuseLoggerInstances.get( name );
if ( logger == null ) { if ( logger == null ) {
logger = new Log4DelegatingLogger( "".equals( name ) ? "ROOT" : name ); logger = new Log4J2DelegatingLogger( "".equals( name ) ? "ROOT" : name );
Logger previous = reuseLoggerInstances.putIfAbsent( name, logger ); Logger previous = reuseLoggerInstances.putIfAbsent( name, logger );
if ( previous != null ) { if ( previous != null ) {
return previous; return previous;
@ -44,57 +46,67 @@ public class TestableLoggerProvider implements org.jboss.logging.LoggerProvider
@Override @Override
public void clearMdc() { public void clearMdc() {
MDC.clear(); ThreadContext.clearMap();
} }
public Object getMdc(String key) { @Override
return MDC.get( key ); public Object putMdc(String key, Object value) {
}
@SuppressWarnings("unchecked")
public Map<String, Object> getMdcMap() {
return MDC.getContext();
}
public Object putMdc(String key, Object val) {
try { try {
return MDC.get( key ); return ThreadContext.get( key );
} }
finally { finally {
MDC.put( key, val ); ThreadContext.put( key, String.valueOf( value ) );
} }
} }
@Override
public Object getMdc(String key) {
return ThreadContext.get( key );
}
@Override
public void removeMdc(String key) { public void removeMdc(String key) {
MDC.remove( key ); ThreadContext.remove( key );
} }
@Override
public Map<String, Object> getMdcMap() {
return new HashMap<>( ThreadContext.getImmutableContext() );
}
@Override
public void clearNdc() { public void clearNdc() {
NDC.remove(); ThreadContext.clearStack();
} }
@Override
public String getNdc() { public String getNdc() {
return NDC.get(); return ThreadContext.peek();
} }
@Override
public int getNdcDepth() { public int getNdcDepth() {
return NDC.getDepth(); return ThreadContext.getDepth();
}
public String peekNdc() {
return NDC.peek();
} }
@Override
public String popNdc() { public String popNdc() {
return NDC.pop(); return ThreadContext.pop();
} }
@Override
public String peekNdc() {
return ThreadContext.peek();
}
@Override
public void pushNdc(String message) { public void pushNdc(String message) {
NDC.push( message ); ThreadContext.push( message );
} }
@Override
public void setNdcMaxDepth(int maxDepth) { public void setNdcMaxDepth(int maxDepth) {
NDC.setMaxDepth( maxDepth ); ThreadContext.trim( maxDepth );
} }
} }

View File

@ -30,7 +30,7 @@ public class LogDelegationTest {
@Test @Test
public void testLogDelegationIsActivated() { public void testLogDelegationIsActivated() {
assertThat( LOG, instanceOf( Log4DelegatingLogger.class ) ); assertThat( LOG, instanceOf( Log4J2DelegatingLogger.class ) );
} }
@Test @Test

View File

@ -1,60 +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>.
#
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
#log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L (hibernateLoadPlanWalkPath->%X{hibernateLoadPlanWalkPath}) - %m%n
#log4j.appender.stdout-mdc=org.apache.log4j.ConsoleAppender
#log4j.appender.stdout-mdc.Target=System.out
#log4j.appender.stdout-mdc.layout=org.apache.log4j.PatternLayout
#log4j.appender.stdout-mdc.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L (walk path -> %X{hibernateLoadPlanWalkPath}) - %m%n
log4j.appender.unclosedSessionFactoryFile=org.apache.log4j.FileAppender
log4j.appender.unclosedSessionFactoryFile.append=true
log4j.appender.unclosedSessionFactoryFile.file=target/tmp/log/UnclosedSessionFactoryWarnings.log
log4j.appender.unclosedSessionFactoryFile.layout=org.apache.log4j.PatternLayout
log4j.appender.unclosedSessionFactoryFile.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info, stdout
#log4j.logger.org.hibernate.loader.plan=trace, stdout-mdc
#log4j.additivity.org.hibernate.loader.plan=false
#log4j.logger.org.hibernate.persister.walking=trace, stdout-mdc
#log4j.additivity.org.hibernate.persister.walking=false
log4j.logger.org.hibernate.tool.hbm2ddl=trace
log4j.logger.org.hibernate.testing.cache=debug
# SQL Logging - HHH-6833
log4j.logger.org.hibernate.SQL=debug
log4j.logger.org.hibernate.type.descriptor.sql.BasicBinder=trace
log4j.logger.org.hibernate.type.descriptor.sql.BasicExtractor=trace
log4j.logger.org.hibernate.hql.internal.ast=debug
log4j.logger.org.hibernate.sql.ordering.antlr=debug
log4j.logger.org.hibernate.loader.plan2.build.internal.LoadPlanImpl=debug
log4j.logger.org.hibernate.loader.plan2.build.spi.LoadPlanTreePrinter=debug
log4j.logger.org.hibernate.loader.plan2.exec.spi.EntityLoadQueryDetails=debug
log4j.logger.org.hibernate.engine.internal.StatisticalLoggingSessionEventListener=info
log4j.logger.org.hibernate.boot.model.source.internal.hbm.ModelBinder=debug
log4j.logger.org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry=debug
### When entity copy merge functionality is enabled using:
### hibernate.event.merge.entity_copy_observer=log, the following will
### provide information about merged entity copies.
### log4j.logger.org.hibernate.event.internal.EntityCopyAllowedLoggedObserver=debug
log4j.logger.org.hibernate.testing.junit4.TestClassMetadata=info, unclosedSessionFactoryFile
log4j.logger.org.hibernate.boot.model.process.internal.ScanningCoordinator=debug

View File

@ -0,0 +1,83 @@
#
# 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>.
#
appender.stdout.type=Console
appender.stdout.name=STDOUT
appender.stdout.layout.type=PatternLayout
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L (hibernateLoadPlanWalkPath->%X{hibernateLoadPlanWalkPath}) - %m%n
appender.stdout-mdc.type=Console
appender.stdout-mdc.name=stdout-mdc
appender.stdout-mdc.layout.type=PatternLayout
appender.stdout-mdc.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L (walk path -> %X{hibernateLoadPlanWalkPath}) - %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
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
logger.loader-plan.name=org.hibernate.loader.plan
#logger.loader-plan.level=trace
#logger.loader-plan.appenderRef.stdout-mdc.ref=stdout-mdc
#logger.loader-plan.additivity=false
logger.persister-walking.name=org.hibernate.persister.walking
#logger.persister-walking.level=trace
#logger.persister-walking.appenderRef.stdout-mdc.ref=stdout-mdc
#logger.persister-walking.additivity=false
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.sql.BasicBinder
logger.type-basic-binder.level=trace
logger.type-basic-extractor.name=org.hibernate.type.descriptor.sql.BasicExtractor
logger.type-basic-extractor.level=trace
logger.hql-internal-ast.name=org.hibernate.hql.internal.ast
logger.hql-internal-ast.level=debug
logger.sql-ordering-antlr.name=org.hibernate.sql.ordering.antlr
logger.sql-ordering-antlr.level=debug
logger.load-plan-impl.name=org.hibernate.loader.plan2.build.internal.LoadPlanImpl
logger.load-plan-impl.level=debug
logger.load-plan-tree-printer.name=org.hibernate.loader.plan2.build.spi.LoadPlanTreePrinter
logger.load-plan-tree-printer.level=debug
logger.entity-load-query-details.name=org.hibernate.loader.plan2.exec.spi.EntityLoadQueryDetails
logger.entity-load-query-details.level=debug
logger.statistical-logging-session-event-listener.name=org.hibernate.engine.internal.StatisticalLoggingSessionEventListener
logger.statistical-logging-session-event-listener.level=info
logger.model-binder.name=org.hibernate.boot.model.source.internal.hbm.ModelBinder
logger.model-binder.level=debug
logger.java-type-descriptor-registry.name=org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry
logger.java-type-descriptor-registry.level=debug
logger.merged-entity-copies.name=org.hibernate.event.internal.EntityCopyAllowedLoggedObserver
### When entity copy merge functionality is enabled using:
### hibernate.event.merge.entity_copy_observer=log, the following will
### 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

View File

@ -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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
#
### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### direct messages to file hibernate.log ###
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=hibernate.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### direct messages to socket - chainsaw ###
log4j.appender.socket=org.apache.log4j.net.SocketAppender
log4j.appender.socket.remoteHost=localhost
log4j.appender.socket.port=4560
log4j.appender.socket.locationInfo=true
### set log levels - for more verbose logging change 'info' to 'debug' ###
log4j.rootLogger=warn, stdout
#log4j.logger.org.hibernate.jpamodelgen.test.util.CompilationTest=trace

View File

@ -0,0 +1,28 @@
#
# 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>.
#
### direct log messages to stdout ###
appender.stdout.type=Console
appender.stdout.name=STDOUT
appender.stdout.layout.type=PatternLayout
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### direct messages to file hibernate.log ###
appender.file.type=File
appender.file.name=file
appender.file.fileName=hibernate.log
appender.file.layout.type=PatternLayout
appender.file.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### set log levels - for more verbose logging change 'info' to 'debug' ###
rootLogger.level=warn
rootLogger.appenderRef.stdout.ref=STDOUT
logger.compilation-test.name=org.hibernate.jpamodelgen.test.util.CompilationTest
#logger.compilation-test.level=trace