diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java index ae2c46348a..7a746b4aeb 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java @@ -182,7 +182,7 @@ import org.jboss.logging.Logger; @SuppressWarnings("unchecked") public final class AnnotationBinder { - private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, AnnotationBinder.class.getName()); + private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, AnnotationBinder.class.getName() ); /* * Some design description diff --git a/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java b/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java index 8adf879992..bafe0f1dd6 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java @@ -90,6 +90,10 @@ public interface CoreMessageLogger extends BasicLogger { @Message(value = "On release of batch it still contained JDBC statements", id = 10) void batchContainedStatementsOnRelease(); + @LogMessage(level = INFO) + @Message(value = "Binding entity from annotated class: %s", id = 15) + void bindingEntityFromAnnotatedClass(String className); + @LogMessage(level = INFO) @Message(value = "Bytecode provider name : %s", id = 21) void bytecodeProvider(String provider); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/AnnotationBinder.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/AnnotationBinder.java index 25630f1afc..4d7c818ae6 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/AnnotationBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/AnnotationBinder.java @@ -25,9 +25,8 @@ package org.hibernate.metamodel.source.annotations; import java.util.Set; +import org.hibernate.internal.CoreMessageLogger; import org.jboss.jandex.Index; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.hibernate.metamodel.source.annotations.entity.ConfiguredClass; import org.hibernate.metamodel.source.annotations.entity.ConfiguredClassHierarchy; @@ -40,6 +39,7 @@ import org.hibernate.metamodel.source.annotations.global.FetchProfileBinder; import org.hibernate.metamodel.source.annotations.global.TableBinder; import org.hibernate.metamodel.source.annotations.util.ConfiguredClassHierarchyBuilder; import org.hibernate.metamodel.source.internal.MetadataImpl; +import org.jboss.logging.Logger; /** * Main class responsible to creating and binding the Hibernate meta-model from annotations. @@ -50,8 +50,7 @@ import org.hibernate.metamodel.source.internal.MetadataImpl; */ public class AnnotationBinder { - private static final Logger LOG = LoggerFactory.getLogger( AnnotationBinder.class ); - + private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, AnnotationBinder.class.getName() ); private final MetadataImpl metadata; private final Index index; @@ -86,7 +85,7 @@ public class AnnotationBinder { // now we process each hierarchy one at the time for ( ConfiguredClassHierarchy hierarchy : hierarchies ) { for ( ConfiguredClass configuredClass : hierarchy ) { - LOG.info( "Binding entity from annotated class: {}", configuredClass.getName() ); + LOG.bindingEntityFromAnnotatedClass( configuredClass.getName() ); EntityBinder entityBinder = new EntityBinder( metadata, configuredClass ); entityBinder.bind(); } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/HibernateXmlBinder.java b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/HibernateXmlBinder.java index d0ff9dd8fa..0c73841c86 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/HibernateXmlBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/source/hbm/HibernateXmlBinder.java @@ -32,9 +32,8 @@ import java.util.Map; import java.util.Set; import org.dom4j.Element; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.util.StringHelper; import org.hibernate.internal.util.collections.JoinedIterator; import org.hibernate.internal.util.xml.XmlDocument; @@ -42,6 +41,7 @@ import org.hibernate.metamodel.domain.MetaAttribute; import org.hibernate.metamodel.source.internal.JaxbRoot; import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping; import org.hibernate.metamodel.source.spi.MetadataImplementor; +import org.jboss.logging.Logger; /** * Binder for {@code hbm.xml} files @@ -49,7 +49,7 @@ import org.hibernate.metamodel.source.spi.MetadataImplementor; * @author Steve Ebersole */ public class HibernateXmlBinder { - private static final Logger log = LoggerFactory.getLogger( HibernateXmlBinder.class ); + private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, HibernateXmlBinder.class.getName() ); private final MetadataImplementor metadata; private final Map globalMetas; @@ -64,7 +64,7 @@ public class HibernateXmlBinder { } public void bindRoot(JaxbRoot jaxbRoot) { - log.debug( jaxbRoot.toString() ); + if (LOG.isDebugEnabled()) LOG.debugf( jaxbRoot.toString() ); bindRoot( jaxbRoot, Collections.emptySet() ); } diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/xml/mocker/XmlHelper.java b/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/xml/mocker/XmlHelper.java index 3858e8bc9d..a6f0115d8a 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/xml/mocker/XmlHelper.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/source/annotations/xml/mocker/XmlHelper.java @@ -33,8 +33,8 @@ import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.hibernate.internal.CoreMessageLogger; +import org.jboss.logging.Logger; import org.xml.sax.SAXException; import org.hibernate.metamodel.source.Origin; @@ -45,7 +45,7 @@ import org.hibernate.service.classloading.spi.ClassLoaderService; * @author Hardy Ferentschik */ public class XmlHelper { - private static final Logger log = LoggerFactory.getLogger( XmlHelper.class ); + private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, XmlHelper.class.getName() ); private XmlHelper() { } @@ -71,7 +71,7 @@ public class XmlHelper { schema = sf.newSchema( schemaUrl ); } catch ( SAXException e ) { - log.debug( "Unable to create schema for {}: {}", schemaVersion, e.getMessage() ); + LOG.debugf( "Unable to create schema for %s: %s", schemaVersion, e.getMessage() ); } return schema; }