Java Mailing List Archive

http://www.gg3721.com/

Home » Hibernate Commits List »

[hibernate-commits] Hibernate SVN: r14671 - in annotations/trunk:
 src/java/org/hibernate/cfg and 5 other directories.

hibernate-commits

2008-05-17


Author LoginPost Reply
Author: epbernard
Date: 2008-05-17 08:49:38 -0400 (Sat, 17 May 2008)
New Revision: 14671

Modified:
 annotations/trunk/ivy.xml
 annotations/trunk/pom.xml
 annotations/trunk/src/java/org/hibernate/cfg/AnnotationBinder.java
 annotations/trunk/src/java/org/hibernate/cfg/AnnotationConfiguration.java
 annotations/trunk/src/java/org/hibernate/cfg/BinderHelper.java
 annotations/trunk/src/java/org/hibernate/cfg/EJB3DTDEntityResolver.java
 annotations/trunk/src/java/org/hibernate/cfg/Ejb3Column.java
 annotations/trunk/src/java/org/hibernate/cfg/ExtendedMappings.java
 annotations/trunk/src/java/org/hibernate/cfg/annotations/CollectionBinder.java
 annotations/trunk/src/java/org/hibernate/cfg/annotations/EntityBinder.java
 annotations/trunk/src/java/org/hibernate/cfg/annotations/ListBinder.java
 annotations/trunk/src/java/org/hibernate/cfg/annotations/PropertyBinder.java
 annotations/trunk/src/java/org/hibernate/cfg/annotations/QueryBinder.java
 annotations/trunk/src/java/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java
 annotations/trunk/src/java/org/hibernate/cfg/annotations/SetBinder.java
 annotations/trunk/src/java/org/hibernate/cfg/annotations/SimpleValueBinder.java
 annotations/trunk/src/java/org/hibernate/cfg/annotations/TableBinder.java
 annotations/trunk/src/java/org/hibernate/cfg/annotations/Version.java
 annotations/trunk/src/java/org/hibernate/cfg/annotations/reflection/EJB3OverridenAnnotationReader.java
 annotations/trunk/src/java/org/hibernate/cfg/annotations/reflection/XMLContext.java
 annotations/trunk/src/java/org/hibernate/cfg/search/SearchConfiguration.java
 annotations/trunk/src/java/org/hibernate/type/EnumType.java
 annotations/trunk/src/test/org/hibernate/test/annotations/reflection/LogListener.java
 annotations/trunk/src/test/org/hibernate/test/annotations/reflection/OtherLogListener.java
Log:
ANN-741 move to slf4j

Modified: annotations/trunk/ivy.xml
===================================================================
--- annotations/trunk/ivy.xml  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/ivy.xml  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
     <dependency name="ejb3-persistence" rev="1.0.2.GA" conf="default->default"/>
     <dependency name="commons-annotations" rev="latest" conf="default->default"/>
     <dependency org="org.hibernate" name="hibernate-core" rev="3.3.0.CR1" conf="default->default"/>
-     <dependency org="commons-logging" name="commons-logging" rev="1.0.4" conf="default->default"/>
     <dependency org="dom4j" name="dom4j" rev="1.6.1" conf="default->default"/>
+     <dependency org="org.slf4j" name="slf4j-api" rev="1.4.2" conf="default->default"/>

+
     <!-- transitive dependencies -->
-     <dependency org="org.slf4j" name="slf4j-api" rev="1.4.2" conf="test->default"/>
     <dependency org="antlr" name="antlr" rev="2.7.6" conf="test->default"/>
     <dependency org="commons-collections" name="commons-collections" rev="3.1" conf="test->default"/>


Modified: annotations/trunk/pom.xml
===================================================================
--- annotations/trunk/pom.xml  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/pom.xml  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
     <version>3.3.0.CR1</version>
   </dependency>
   <dependency>
-      <groupId>commons-logging</groupId>
-      <artifactId>commons-logging</artifactId>
-      <version>1.0.4</version>
-    </dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-api</artifactId>
+        <version>1.4.2</version>
+     </dependency>
     <dependency>
     <groupId>dom4j</groupId>
     <artifactId>dom4j</artifactId>

Modified: annotations/trunk/src/java/org/hibernate/cfg/AnnotationBinder.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/AnnotationBinder.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/AnnotationBinder.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
import javax.persistence.Transient;
import javax.persistence.Version;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
import org.hibernate.EntityMode;
@@(protected) @@
import org.hibernate.persister.entity.UnionSubclassEntityPersister;
import org.hibernate.type.TypeFactory;
import org.hibernate.util.StringHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

/**
* JSR 175 annotation binder
@@(protected) @@
 private AnnotationBinder() {
 }

-  private static final Log log = LogFactory.getLog( AnnotationBinder.class );
+  private static final Logger log = LoggerFactory.getLogger( AnnotationBinder.class );

 public static void bindDefaults(ExtendedMappings mappings) {
   Map defaults = mappings.getReflectionManager().getDefaults();
@@(protected) @@
     pckg = mappings.getReflectionManager().packageForName( packageName );
   }
   catch (ClassNotFoundException cnf) {
-      log.warn( "Package not found or wo package-info.java: " + packageName );
+      log.warn( "Package not found or wo package-info.java: {}", packageName );
     return;
   }
   if ( pckg.isAnnotationPresent( SequenceGenerator.class ) ) {
     SequenceGenerator ann = pckg.getAnnotation( SequenceGenerator.class );
     IdGenerator idGen = buildIdGenerator( ann, mappings );
     mappings.addGenerator( idGen );
-      log.debug( "Add sequence generator with name: " + idGen.getName() );
+      log.debug( "Add sequence generator with name: {}", idGen.getName() );
   }
   if ( pckg.isAnnotationPresent( TableGenerator.class ) ) {
     TableGenerator ann = pckg.getAnnotation( TableGenerator.class );
@@(protected) @@
       idGen.addParam( MultipleHiLoPerTableGenerator.PK_VALUE_NAME, tabGen.pkColumnValue() );
     }
     idGen.addParam( TableHiLoGenerator.MAX_LO, String.valueOf( tabGen.allocationSize() - 1 ) );
-      log.debug( "Add table generator with name: " + idGen.getName() );
+      log.debug( "Add table generator with name: {}", idGen.getName() );
   }
   else if ( ann instanceof SequenceGenerator ) {
     SequenceGenerator seqGen = (SequenceGenerator) ann;
@@(protected) @@
       );
     }
     idGen.addParam( SequenceHiLoGenerator.MAX_LO, String.valueOf( seqGen.allocationSize() - 1 ) );
-      log.debug( "Add sequence generator with name: " + idGen.getName() );
+      log.debug( "Add sequence generator with name: {}", idGen.getName() );
   }
   else if ( ann instanceof GenericGenerator ) {
     GenericGenerator genGen = (GenericGenerator) ann;
@@(protected) @@
     for (Parameter parameter : params) {
       idGen.addParam( parameter.name(), parameter.value() );
     }
-      log.debug( "Add generic generator with name: " + idGen.getName() );
+      log.debug( "Add generic generator with name: {}", idGen.getName() );
   }
   else {
     throw new AssertionFailure( "Unknown Generator annotation: " + ann );
@@(protected) @@
     if ( AnnotatedClassType.NONE.equals( classType )
         && clazzToProcess.isAnnotationPresent( org.hibernate.annotations.Entity.class ) ) {
       log.warn( "Class annotated @org.hibernate.annotations.Entity but not javax.persistence.Entity "
-            + "(most likely a user error): " + clazzToProcess.getName() );
+            + "(most likely a user error): {}", clazzToProcess.getName() );
     }
     return;
   }
@@(protected) @@
     );
   }
   XAnnotatedElement annotatedClass = clazzToProcess;
-    if ( log.isInfoEnabled() ) log.info( "Binding entity from annotated class: " + clazzToProcess.getName() );
+    log.info( "Binding entity from annotated class: {}", clazzToProcess.getName() );
   InheritanceState superEntityState =
       InheritanceState.getSuperEntityInheritanceState(
           clazzToProcess, inheritanceStatePerClass, mappings.getReflectionManager()
@@(protected) @@
     }
     if ( discAnn != null && inheritanceState.hasParents ) {
       log.warn(
-            "Discriminator column has to be defined in the root entity, it will be ignored in subclass: "
-                + clazzToProcess.getName()
+            "Discriminator column has to be defined in the root entity, it will be ignored in subclass: {}",
+            clazzToProcess.getName()
       );
     }
     discrimValue = annotatedClass.isAnnotationPresent( DiscriminatorValue.class ) ?
@@(protected) @@
   }
   if ( onDeleteAnn != null && !onDeleteAppropriate ) {
     log.warn(
-          "Inapropriate use of @OnDelete on entity, annotation ignored: " + propertyHolder.getEntityName()
+          "Inapropriate use of @OnDelete on entity, annotation ignored: {}", propertyHolder.getEntityName()
     );
   }

@@(protected) @@
     params.put( param.name(), TypeFactory.heuristicType( param.type() ) );
   }
   FilterDefinition def = new FilterDefinition( defAnn.name(), defAnn.defaultCondition(), params );
-    if ( log.isInfoEnabled() ) log.info( "Binding filter definition: " + def.getFilterName() );
+    log.info( "Binding filter definition: {}", def.getFilterName() );
   mappings.addFilterDefinition( def );
 }

@@(protected) @@
   for (Parameter param : defAnn.parameters()) {
     params.setProperty( param.name(), param.value() );
   }
-    if ( log.isInfoEnabled() ) log.info( "Binding type definition: " + defAnn.name() );
+    log.info( "Binding type definition: {}", defAnn.name() );
   mappings.addTypeDef( defAnn.name(), defAnn.typeClass().getName(), params );
 }

@@(protected) @@
     discriminatorColumn.linkWithValue( discrim );
     discrim.setTypeName( discriminatorColumn.getDiscriminatorTypeName() );
     rootClass.setPolymorphic( true );
-      log.debug( "Setting discriminator for entity " + rootClass.getEntityName() );
+      log.debug( "Setting discriminator for entity {}", rootClass.getEntityName() );
   }
 }

@@(protected) @@
     }
   }

-    log.debug( "Processing " + propertyHolder.getEntityName() + " " + accessType + " annotation" );
+    log.debug( "Processing {} {} annotation", propertyHolder.getEntityName(), accessType );
   List<XProperty> properties = annotatedClass.getDeclaredProperties( accessType );
   //order so that property are used in the same order when binding native query
   Collections.sort( properties, new Comparator<XProperty>() {
@@(protected) @@
    */
   Ejb3Column[] columns = null;
   Ejb3JoinColumn[] joinColumns = null;
-    if ( log.isDebugEnabled() ) {
-      log.debug(
-          "Processing annotations of " + propertyHolder.getEntityName() + "." + inferredData.getPropertyName()
-      );
-    }
+    log.debug(
+        "Processing annotations of {}.{}", propertyHolder.getEntityName(), inferredData.getPropertyName()
+    );

   if ( property.isAnnotationPresent( Parent.class ) ) {
     if ( propertyHolder.isComponent() ) {
@@(protected) @@
           "@(protected)"
       );
     }
-      log.debug( inferredData.getPropertyName() + " is an id" );
+      log.debug( "{} is an id", inferredData.getPropertyName() );
     //clone classGenerator and override with local values
     HashMap<String, IdGenerator> localGenerators = (HashMap<String, IdGenerator>) classGenerators.clone();
     localGenerators.putAll( buildLocalGenerators( property, mappings ) );
@@(protected) @@
         false,
         isIdentifierMapper, mappings
     );
-      if ( log.isDebugEnabled() ) {
-        log.debug(
-            "Bind " + ( isComponent ?
-                "@(protected)" :
-                "@(protected)()
-        );
-      }
+      log.debug(
+          "Bind {} on {}", ( isComponent ? "@(protected)()
+      );
   }
   else if ( property.isAnnotationPresent( Version.class ) ) {
     if ( isIdentifierMapper ) {
@@(protected) @@
               + propertyHolder.getEntityName()
       );
     }
-      log.debug( inferredData.getPropertyName() + " is a version property" );
+      log.debug( "{} is a version property", inferredData.getPropertyName() );
     RootClass rootClass = (RootClass) propertyHolder.getPersistentClass();
     PropertyBinder propBinder = new PropertyBinder();
     propBinder.setName( inferredData.getPropertyName() );
@@(protected) @@
     simpleValue.setNullValue( "undefined" );
     rootClass.setOptimisticLockMode( Versioning.OPTIMISTIC_LOCK_VERSION );
     log.debug(
-          "Version name: " + rootClass.getVersion().getName() + ", unsavedValue: " + ( (SimpleValue) rootClass
-              .getVersion()
-              .getValue() ).getNullValue()
+          "Version name: {}, unsavedValue: {}", rootClass.getVersion().getName(),
+          ( (SimpleValue) rootClass.getVersion().getValue() ).getNullValue()
     );
   }
   else if ( property.isAnnotationPresent( ManyToOne.class ) ) {
@@(protected) @@
   }
   comp.setNodeName( inferredData.getPropertyName() );
   String subpath = StringHelper.qualify( propertyHolder.getPath(), inferredData.getPropertyName() );
-    log.debug( "Binding component with path: " + subpath );
+    log.debug( "Binding component with path: {}", subpath );
   PropertyHolder subHolder = PropertyHolderBuilder.buildPropertyHolder(
       comp, subpath,
       inferredData, propertyHolder, mappings
@@(protected) @@
 ) {
   //column.getTable() => persistentClass.getTable()
   final String propertyName = inferredData.getPropertyName();
-    log.debug( "Fetching " + propertyName + " with " + fetchMode );
+    log.debug( "Fetching {} with {}", propertyName, fetchMode );
   boolean mapToPK = true;
   if ( !trueOneToOne ) {
     //try to find a hidden true one to one (FK == PK columns)
@@(protected) @@
         final boolean mixingStrategy = state.type != null && !state.type.equals( superclassState.type );
         if ( nonDefault && mixingStrategy ) {
           log.warn(
-                "Mixing inheritance strategy in a entity hierarchy is not allowed, ignoring sub strategy in: " + clazz
-                    .getName()
+                "Mixing inheritance strategy in a entity hierarchy is not allowed, ignoring sub strategy in: {}",
+                clazz.getName()
           );
         }
         state.type = superclassState.type;

Modified: annotations/trunk/src/java/org/hibernate/cfg/AnnotationConfiguration.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/AnnotationConfiguration.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/AnnotationConfiguration.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
@@(protected) @@
import java.util.SortedSet;
import java.util.StringTokenizer;
import java.util.TreeSet;
-import java.net.URL;
-
import javax.persistence.Entity;
import javax.persistence.MappedSuperclass;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.DocumentException;
@@(protected) @@
import org.dom4j.io.SAXReader;
import org.hibernate.AnnotationException;
import org.hibernate.HibernateException;
+import org.hibernate.Interceptor;
import org.hibernate.MappingException;
import org.hibernate.SessionFactory;
-import org.hibernate.Interceptor;
import org.hibernate.annotations.AnyMetaDef;
import org.hibernate.annotations.common.reflection.ReflectionManager;
import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.cfg.annotations.Version;
import org.hibernate.cfg.annotations.reflection.EJB3ReflectionManager;
import org.hibernate.cfg.search.SearchConfiguration;
-import org.hibernate.event.PostDeleteEventListener;
-import org.hibernate.event.PostInsertEventListener;
-import org.hibernate.event.PostUpdateEventListener;
import org.hibernate.event.PreInsertEventListener;
import org.hibernate.event.PreUpdateEventListener;
-import org.hibernate.event.EventListeners;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Join;
import org.hibernate.mapping.PersistentClass;
@@(protected) @@
import org.hibernate.util.StringHelper;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

/**
* Similar to the {@(protected)
@@(protected) @@
* @author Emmanuel Bernard
*/
public class AnnotationConfiguration extends Configuration {
-  private static Log log = LogFactory.getLog( AnnotationConfiguration.class );
+  private Logger log = LoggerFactory.getLogger( AnnotationConfiguration.class );

 static {
   Version.touch(); //touch version
@@(protected) @@
  * @return the configuration object
  */
 public AnnotationConfiguration addPackage(String packageName) throws MappingException {
-    log.info( "Mapping package " + packageName );
+    log.info( "Mapping package {}", packageName );
   try {
     AnnotationBinder.bindPackage( packageName, createExtendedMappings() );
     return this;
@@(protected) @@
     annotatedClassEntities.clear();
   }
   else {
-      log.warn( "Unknown artifact: " + artifact );
+      log.warn( "Unknown artifact: {}", artifact );
   }
 }

@@(protected) @@
   Attribute pckg = subelement.attribute( "package" );
   Attribute clazz = subelement.attribute( "class" );
   if ( rsrc != null ) {
-      log.debug( name + "<-" + rsrc );
+      log.debug( "{} <- {}", name, rsrc );
     addResource( rsrc.getValue() );
   }
   else if ( jar != null ) {
-      log.debug( name + "<-" + jar );
+      log.debug( "{} <- {}", name, jar );
     addJar( new File( jar.getValue() ) );
   }
   else if ( file != null ) {
-      log.debug( name + "<-" + file );
+      log.debug( "{} <- {}", name, file );
     addFile( file.getValue() );
   }
   else if ( pckg != null ) {
-      log.debug( name + "<-" + pckg );
+      log.debug( "{} <- {}", name, pckg );
     addPackage( pckg.getValue() );
   }
   else if ( clazz != null ) {
-      log.debug( name + "<-" + clazz );
-      Class loadedClass = null;
+      log.debug( "{} <- {}", name, clazz );
+      Class loadedClass;
     try {
       loadedClass = ReflectHelper.classForName( clazz.getValue() );
     }

Modified: annotations/trunk/src/java/org/hibernate/cfg/BinderHelper.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/BinderHelper.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/BinderHelper.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
import java.util.Set;
import java.util.StringTokenizer;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
import org.hibernate.MappingException;
@@(protected) @@
import org.hibernate.mapping.Value;
import org.hibernate.type.TypeFactory;
import org.hibernate.util.StringHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

/**
* @author Emmanuel Bernard
@@(protected) @@
public class BinderHelper {

 public static final String ANNOTATION_STRING_DEFAULT = "";
-  private static Log log = LogFactory.getLog( BinderHelper.class );
+  private static Logger log = LoggerFactory.getLogger( BinderHelper.class );

 private BinderHelper() {
 }
@@(protected) @@

 private static void bindAnyMetaDef(AnyMetaDef defAnn, ExtendedMappings mappings) {
   if ( isDefault( defAnn.name() ) ) return; //don't map not named definitions
-    if ( log.isInfoEnabled() ) log.info( "Binding Any Meta definition: " + defAnn.name() );
+    log.info( "Binding Any Meta definition: {}", defAnn.name() );
   mappings.addAnyMetaDef( defAnn );
 }
}

Modified: annotations/trunk/src/java/org/hibernate/cfg/EJB3DTDEntityResolver.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/EJB3DTDEntityResolver.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/EJB3DTDEntityResolver.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@

import java.io.InputStream;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.util.DTDEntityResolver;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

/**
* @author Emmanuel Bernard
@@(protected) @@
public class EJB3DTDEntityResolver extends DTDEntityResolver {
 public static final EntityResolver INSTANCE = new EJB3DTDEntityResolver();

-  private static final Log log = LogFactory.getLog( EJB3DTDEntityResolver.class );
+  private final Logger log = LoggerFactory.getLogger( EJB3DTDEntityResolver.class );

 boolean resolved = false;

@@(protected) @@
         String path = "org/hibernate/ejb/" + "orm_1_0.xsd";
         InputStream dtdStream = resolveInHibernateNamespace( path );
         if ( dtdStream == null ) {
-            log.debug( "unable to locate [" + systemId + "] on classpath" );
+            log.debug( "unable to locate [{}] on classpath", systemId );
         }
         else {
-            log.debug( "located [" + systemId + "] in classpath" );
+            log.debug( "located [{}] in classpath", systemId );
           InputSource source = new InputSource( dtdStream );
           source.setPublicId( publicId );
           source.setSystemId( systemId );
@@(protected) @@
         String path = "org/hibernate/ejb/" + "persistence_1_0.xsd";
         InputStream dtdStream = resolveInHibernateNamespace( path );
         if ( dtdStream == null ) {
-            log.debug( "unable to locate [" + systemId + "] on classpath" );
+            log.debug( "unable to locate [{}] on classpath", systemId );
         }
         else {
-            log.debug( "located [" + systemId + "] in classpath" );
+            log.debug( "located [{}] in classpath", systemId );
           InputSource source = new InputSource( dtdStream );
           source.setPublicId( publicId );
           source.setSystemId( systemId );

Modified: annotations/trunk/src/java/org/hibernate/cfg/Ejb3Column.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/Ejb3Column.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/Ejb3Column.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@

import java.util.Map;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
import org.hibernate.annotations.Index;
@@(protected) @@
import org.hibernate.mapping.SimpleValue;
import org.hibernate.mapping.Table;
import org.hibernate.util.StringHelper;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;

/**
* Wrap state of an EJB3 @Column annotation
@@(protected) @@
* @author Emmanuel Bernard
*/
public class Ejb3Column {
-  private static final Log log = LogFactory.getLog( Ejb3Column.class );
+  private static final Logger log = LoggerFactory.getLogger( Ejb3Column.class );
 private Column mappingColumn;
 private boolean insertable = true;
 private boolean updatable = true;
@@(protected) @@

 public void bind() {
   if ( StringHelper.isNotEmpty( formulaString ) ) {
-      log.debug( "binding formula " + formulaString );
+      log.debug( "binding formula {}", formulaString );
     formula = new Formula();
     formula.setFormula( formulaString );
   }
@@(protected) @@
     initMappingColumn(
         logicalColumnName, propertyName, length, precision, scale, nullable, sqlType, unique, true
     );
-      log.debug( "Binding column " + mappingColumn.getName() + " unique " + unique );
+      log.debug( "Binding column {}. Unique {}", mappingColumn.getName(), unique );
   }
 }

@@(protected) @@
         throw new AnnotationException( "AttributeOverride.column() should override all columns for now" );
       }
       actualCols = overriddenCols.length == 0 ? null : overriddenCols;
-        log.debug( "Column(s) overridden for property " + inferredData.getPropertyName() );
+        log.debug( "Column(s) overridden for property {}", inferredData.getPropertyName() );
     }
     if ( actualCols == null ) {
       columns = buildImplicitColumn( inferredData, secondaryTables, propertyHolder, nullability, mappings );

Modified: annotations/trunk/src/java/org/hibernate/cfg/ExtendedMappings.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/ExtendedMappings.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/ExtendedMappings.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
import javax.persistence.Entity;
import javax.persistence.MappedSuperclass;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.AnnotationException;
import org.hibernate.MappingException;
import org.hibernate.annotations.AnyMetaDef;
@@(protected) @@
import org.hibernate.mapping.Join;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Table;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;

/**
* Allow annotation related mappings
@@(protected) @@
*/
public class ExtendedMappings extends Mappings {

-  private static final Log log = LogFactory.getLog( ExtendedMappings.class );
+  private final Logger log = LoggerFactory.getLogger( ExtendedMappings.class );

 private final Map<String, IdGenerator> namedGenerators;
 private final Map<String, Map<String, Join>> joins;
@@(protected) @@
 public void addGenerator(IdGenerator generator) throws MappingException {
   if ( !defaultNamedGenerators.contains( generator.getName() ) ) {
     Object old = namedGenerators.put( generator.getName(), generator );
-      if ( old != null ) log.warn( "duplicate generator name: " + generator.getName() );
+      if ( old != null ) log.warn( "duplicate generator name: {}", generator.getName() );
   }
 }

 public void addJoins(PersistentClass persistentClass, Map<String, Join> joins) throws MappingException {
   Object old = this.joins.put( persistentClass.getEntityName(), joins );
-    if ( old != null ) log.warn( "duplicate joins for class: " + persistentClass.getEntityName() );
+    if ( old != null ) log.warn( "duplicate joins for class: {}", persistentClass.getEntityName() );
 }

 public AnnotatedClassType addClassType(XClass clazz) {
@@(protected) @@

 public void addGeneratorTable(String name, Properties params) {
   Object old = generatorTables.put( name, params );
-    if ( old != null ) log.warn( "duplicate generator table: " + name );
+    if ( old != null ) log.warn( "duplicate generator table: {}", name );
 }

 public Properties getGeneratorTableProperties(String name, Map<String, Properties> localGeneratorTables) {

Modified: annotations/trunk/src/java/org/hibernate/cfg/annotations/CollectionBinder.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/annotations/CollectionBinder.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/annotations/CollectionBinder.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
import javax.persistence.MapKey;
import javax.persistence.OneToMany;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
import org.hibernate.FetchMode;
@@(protected) @@
import org.hibernate.mapping.SimpleValue;
import org.hibernate.mapping.Table;
import org.hibernate.util.StringHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

/**
* Collection binder
@@(protected) @@
*/
public abstract class CollectionBinder {

-  private static final Log log = LogFactory.getLog( CollectionBinder.class );
+  private Logger log = LoggerFactory.getLogger( CollectionBinder.class );

 protected Collection collection;
 protected String propertyName;
@@(protected) @@

 public void bind() {
   this.collection = createCollection( propertyHolder.getPersistentClass() );
-    log.debug( "Collection role: " + StringHelper.qualify( propertyHolder.getPath(), propertyName ) );
+    log.debug( "Collection role: {}", StringHelper.qualify( propertyHolder.getPath(), propertyName ) );
   collection.setRole( StringHelper.qualify( propertyHolder.getPath(), propertyName ) );
   collection.setNodeName( propertyName );

@@(protected) @@
     XClass collectionType,
     boolean cascadeDeleteEnabled, boolean ignoreNotFound, String hqlOrderBy, ExtendedMappings extendedMappings
 ) {
-    if ( log.isDebugEnabled() ) {
-      log.debug(
-          "Binding a OneToMany: " + propertyHolder.getEntityName() + "." + propertyName + " through a foreign key"
-      );
-    }
+
+    log.debug("Binding a OneToMany: {}.{} through a foreign key", propertyHolder.getEntityName(), propertyName);
   org.hibernate.mapping.OneToMany oneToMany = new org.hibernate.mapping.OneToMany( collection.getOwner() );
   collection.setElement( oneToMany );
   oneToMany.setReferencedEntityName( collectionType.getName() );
@@(protected) @@
   if ( log.isDebugEnabled() ) {
     String path = collValue.getOwnerEntityName() + "." + joinColumns[0].getPropertyName();
     if ( isCollectionOfEntities && unique ) {
-        log.debug( "Binding a OneToMany: " + path + " through an association table" );
+        log.debug( "Binding a OneToMany: {} through an association table", path );
     }
     else if ( isCollectionOfEntities ) {
-        log.debug( "Binding as ManyToMany: " + path );
+        log.debug( "Binding as ManyToMany: {}", path );
     }
     else if ( anyAnn != null ) {
-        log.debug( "Binding a ManyToAny: " + path );
+        log.debug( "Binding a ManyToAny: {}", path );
     }
     else {
-        log.debug( "Binding a collection of element: " + path );
+        log.debug( "Binding a collection of element: {}", path );
     }
   }
   //check for user error

Modified: annotations/trunk/src/java/org/hibernate/cfg/annotations/EntityBinder.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/annotations/EntityBinder.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/annotations/EntityBinder.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
import javax.persistence.SecondaryTables;
import javax.persistence.UniqueConstraint;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
import org.hibernate.EntityMode;
@@(protected) @@
import org.hibernate.mapping.Value;
import org.hibernate.util.ReflectHelper;
import org.hibernate.util.StringHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

/**
* Stateful holder and processor for binding Entity information
@@(protected) @@
 private XClass annotatedClass;
 private PersistentClass persistentClass;
 private ExtendedMappings mappings;
-  private static Log log = LogFactory.getLog( EntityBinder.class );
+  private Logger log = LoggerFactory.getLogger( EntityBinder.class );
 private String discriminatorValue = "";
 private boolean isPropertyAnnotated = false;
 private boolean dynamicInsert;
@@(protected) @@
   }
   else {
     if ( explicitHibernateEntityAnnotation ) {
-        log.warn( "@(protected) "
-            + annotatedClass.getName() );
+        log.warn( "@(protected) {}",
+            annotatedClass.getName() );
     }
     if ( annotatedClass.isAnnotationPresent( Immutable.class ) ) {
-        log.warn( "@(protected) "
-            + annotatedClass.getName() );
+        log.warn( "@(protected) {}",
+            annotatedClass.getName() );
     }
   }
   persistentClass.setOptimisticLockMode( getVersioning( optimisticLockType ) );
@@(protected) @@
   }
   else {
     if ( filters.size() > 0 ) {
-        log.warn( "@(protected)() );
+        log.warn( "@(protected)() );
     }
   }
-    log.debug( "Import with entity name=" + name );
+    log.debug( "Import with entity name {}", name );
   try {
     mappings.addImport( persistentClass.getEntityName(), name );
     String entityName = persistentClass.getEntityName();
@@(protected) @@
   );

   if ( persistentClass instanceof TableOwner ) {
-      if ( log.isInfoEnabled() ) {
-        log.info( "Bind entity " + persistentClass.getEntityName() + " on table " + table.getName() );
-      }
+      log.info( "Bind entity {} on table {}", persistentClass.getEntityName(), table.getName() );
     ( (TableOwner) persistentClass ).setTable( table );
   }
   else {
@@(protected) @@
   else if ( joinTable != null ) {
     joinColumns = joinTable.joinColumns();
   }
-    if ( log.isInfoEnabled() ) {
-      log.info(
-          "Adding secondary table to entity " + persistentClass.getEntityName() + " -> " + join.getTable()
-              .getName()
-      );
-    }
+    log.info(
+        "Adding secondary table to entity {} -> {}", persistentClass.getEntityName(), join.getTable().getName()
+    );

   org.hibernate.annotations.Table matchingTable = findMatchingComplimentTableAnnotation( join );
   if ( matchingTable != null ) {

Modified: annotations/trunk/src/java/org/hibernate/cfg/annotations/ListBinder.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/annotations/ListBinder.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/annotations/ListBinder.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@

import java.util.Map;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.AnnotationException;
import org.hibernate.MappingException;
import org.hibernate.annotations.OrderBy;
@@(protected) @@
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.SimpleValue;
import org.hibernate.util.StringHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

/**
* Bind a list
@@(protected) @@
* @author Emmanuel Bernard
*/
public class ListBinder extends CollectionBinder {
-  private static Log log = LogFactory.getLog( ListBinder.class );
+  private Logger log = LoggerFactory.getLogger( ListBinder.class );

 public ListBinder() {
 }

Modified: annotations/trunk/src/java/org/hibernate/cfg/annotations/PropertyBinder.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/annotations/PropertyBinder.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/annotations/PropertyBinder.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
import javax.persistence.EmbeddedId;
import javax.persistence.Id;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.AnnotationException;
import org.hibernate.annotations.Generated;
import org.hibernate.annotations.GenerationTime;
@@(protected) @@
import org.hibernate.mapping.SimpleValue;
import org.hibernate.mapping.Value;
import org.hibernate.util.StringHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

/**
* @author Emmanuel Bernard
*/
public class PropertyBinder {
-  private static Log log = LogFactory.getLog( PropertyBinder.class );
+  private Logger log = LoggerFactory.getLogger( PropertyBinder.class );
 private String name;
 private String returnedClassName;
 private boolean lazy;
@@(protected) @@

 public Property bind() {
   validateBind();
-    if ( log.isDebugEnabled() ) {
-      log.debug( "binding property " + name + " with lazy=" + lazy );
-    }
+    log.debug( "binding property {} with lazy={}", name, lazy );
   String containerClassName = holder == null ?
       null :
       holder.getClassName();

Modified: annotations/trunk/src/java/org/hibernate/cfg/annotations/QueryBinder.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/annotations/QueryBinder.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/annotations/QueryBinder.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
import javax.persistence.SqlResultSetMapping;
import javax.persistence.SqlResultSetMappings;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
import org.hibernate.CacheMode;
@@(protected) @@
import org.hibernate.engine.NamedSQLQueryDefinition;
import org.hibernate.engine.query.sql.NativeSQLQueryReturn;
import org.hibernate.engine.query.sql.NativeSQLQueryRootReturn;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

/**
* Query binder
@@(protected) @@
* @author Emmanuel Bernard
*/
public abstract class QueryBinder {
-  private static Log log = LogFactory.getLog( QueryBinder.class );
+  private static final Logger log = LoggerFactory.getLogger( QueryBinder.class );

 public static void bindQuery(NamedQuery queryAnn, ExtendedMappings mappings, boolean isDefault) {
   if ( queryAnn == null ) return;
@@(protected) @@
   else {
     mappings.addQuery( queryAnn.name(), query );
   }
-    if ( log.isInfoEnabled() ) log.info( "Binding Named query: " + queryAnn.name() + " => " + queryAnn.query() );
+    log.info( "Binding Named query: {} => {}", queryAnn.name(), queryAnn.query() );
 }


@@(protected) @@
   else {
     mappings.addSQLQuery( queryAnn.name(), query );
   }
-    if ( log.isInfoEnabled() ) {
-      log.info( "Binding named native query: " + queryAnn.name() + " => " + queryAnn.query() );
-    }
+    log.info( "Binding named native query: {} => {}", queryAnn.name(), queryAnn.query() );
 }

 public static void bindNativeQuery(org.hibernate.annotations.NamedNativeQuery queryAnn, ExtendedMappings mappings) {
@@(protected) @@
     throw new NotYetImplementedException( "Pure native scalar queries are not yet supported" );
   }
   mappings.addSQLQuery( queryAnn.name(), query );
-    if ( log.isInfoEnabled() ) {
-      log.info( "Binding named native query: " + queryAnn.name() + " => " + queryAnn.query() );
-    }
+    log.info( "Binding named native query: {} => {}", queryAnn.name(), queryAnn.query() );
 }

 public static void bindQueries(NamedQueries queriesAnn, ExtendedMappings mappings, boolean isDefault) {

Modified: annotations/trunk/src/java/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
import javax.persistence.FieldResult;
import javax.persistence.SqlResultSetMapping;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.MappingException;
import org.hibernate.cfg.BinderHelper;
@@(protected) @@
import org.hibernate.mapping.Value;
import org.hibernate.util.CollectionHelper;
import org.hibernate.util.StringHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

/**
* @author Emmanuel Bernard
*/
public class ResultsetMappingSecondPass implements QuerySecondPass {
-  private static Log log = LogFactory.getLog( ResultsetMappingSecondPass.class );
+  private Logger log = LoggerFactory.getLogger( ResultsetMappingSecondPass.class );
 private SqlResultSetMapping ann;
 private ExtendedMappings mappings;
 private boolean isDefault;
@@(protected) @@
   //TODO add parameters checkings
   if ( ann == null ) return;
   ResultSetMappingDefinition definition = new ResultSetMappingDefinition( ann.name() );
-    if ( log.isInfoEnabled() ) log.info( "Binding resultset mapping: " + definition.getName() );
+    log.info( "Binding resultset mapping: {}", definition.getName() );

   int entityAliasIndex = 0;


Modified: annotations/trunk/src/java/org/hibernate/cfg/annotations/SetBinder.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/annotations/SetBinder.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/annotations/SetBinder.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
package org.hibernate.cfg.annotations;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.annotations.OrderBy;
import org.hibernate.cfg.Environment;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.PersistentClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

/**
* Bind a set.
@@(protected) @@
* @author Matthew Inger
*/
public class SetBinder extends CollectionBinder {
-  private static Log log = LogFactory.getLog( SetBinder.class );
+  private final Logger log = LoggerFactory.getLogger( SetBinder.class );

 public SetBinder() {
 }

Modified: annotations/trunk/src/java/org/hibernate/cfg/annotations/SimpleValueBinder.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/annotations/SimpleValueBinder.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/annotations/SimpleValueBinder.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
import javax.persistence.Lob;
import javax.persistence.Temporal;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
import org.hibernate.annotations.Parameter;
@@(protected) @@
import org.hibernate.type.SerializableToBlobType;
import org.hibernate.type.StringClobType;
import org.hibernate.util.StringHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

/**
* @author Emmanuel Bernard
*/
public class SimpleValueBinder {
-  private static Log log = LogFactory.getLog( SimpleValueBinder.class );
+  private Logger log = LoggerFactory.getLogger( SimpleValueBinder.class );
 private String propertyName;
 private String returnedClassName;
 private Ejb3Column[] columns;
@@(protected) @@

 public SimpleValue make() {
   validate();
-    log.debug( "building SimpleValue for " + propertyName );
+    log.debug( "building SimpleValue for {}", propertyName );
   if ( table == null ) {
     table = columns[0].getTable();
   }

Modified: annotations/trunk/src/java/org/hibernate/cfg/annotations/TableBinder.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/annotations/TableBinder.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/annotations/TableBinder.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
import java.util.List;
import javax.persistence.UniqueConstraint;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
import org.hibernate.annotations.Index;
@@(protected) @@
import org.hibernate.mapping.Table;
import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.Value;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

/**
* Table related operations
@@(protected) @@
*/
public class TableBinder {
 //TODO move it to a getter/setter strategy
-  private static Log log = LogFactory.getLog( TableBinder.class );
+  private static Logger log = LoggerFactory.getLogger( TableBinder.class );
 private String schema;
 private String catalog;
 private String name;
@@(protected) @@
      * Get the columns of the mapped-by property
      * copy them and link the copy to the actual value
      */
-      if ( log.isDebugEnabled() ) {
-        log.debug(
-            "Retrieving property " + associatedClass.getEntityName() + "." + mappedByProperty
-        );
-      }
+      log.debug("Retrieving property {}.{}", associatedClass.getEntityName(), mappedByProperty);

     final Property property = associatedClass.getRecursiveProperty( columns[0].getMappedBy() );
     Iterator mappedByColumns;

Modified: annotations/trunk/src/java/org/hibernate/cfg/annotations/Version.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/annotations/Version.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/annotations/Version.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
//$Id: $
package org.hibernate.cfg.annotations;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

/**
* @author Emmanuel Bernard
*/
public class Version {
 public static final String VERSION = "3.3.1.GA";
-  private static Log log = LogFactory.getLog( Version.class );
+  private static Logger log = LoggerFactory.getLogger( Version.class );

 static {
-    log.info( "Hibernate Annotations " + VERSION );
+    log.info( "Hibernate Annotations {}", VERSION );
 }

 public static void touch() {

Modified: annotations/trunk/src/java/org/hibernate/cfg/annotations/reflection/EJB3OverridenAnnotationReader.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/annotations/reflection/EJB3OverridenAnnotationReader.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/annotations/reflection/EJB3OverridenAnnotationReader.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
import javax.persistence.UniqueConstraint;
import javax.persistence.Version;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.dom4j.Attribute;
import org.dom4j.Element;
import org.hibernate.AnnotationException;
@@(protected) @@
import org.hibernate.annotations.common.reflection.ReflectionUtil;
import org.hibernate.util.ReflectHelper;
import org.hibernate.util.StringHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

/**
* Encapsulates the overriding of Java annotations from an EJB 3.0 descriptor.
@@(protected) @@
* @author Emmanuel Bernard
*/
public class EJB3OverridenAnnotationReader implements AnnotationReader {
-  private static Log log = LogFactory.getLog( EJB3OverridenAnnotationReader.class );
+  private Logger log = LoggerFactory.getLogger( EJB3OverridenAnnotationReader.class );
 private static final Map<Class, String> annotationToXml;
 private static final String SCHEMA_VALIDATION = "Activate schema validation for more informations";
 private static final Filter FILTER = new Filter() {
@@(protected) @@
     for (Element subelement : (List<Element>) element.elements()) {
       String propertyName = subelement.attributeValue( "name" );
       if ( !properties.contains( propertyName ) ) {
-          log.warn( "Property " + StringHelper.qualify( className, propertyName ) + " not found in class"
-              + " but described in <mapping-file/> (possible typo error)" );
+          log.warn( "Property {} not found in class"
+              + " but described in <mapping-file/> (possible typo error)",
+              StringHelper.qualify( className, propertyName ) );
       }
     }
   }

Modified: annotations/trunk/src/java/org/hibernate/cfg/annotations/reflection/XMLContext.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/annotations/reflection/XMLContext.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/annotations/reflection/XMLContext.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
import java.util.List;
import java.util.Map;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.dom4j.Document;
import org.dom4j.Element;
import org.hibernate.util.StringHelper;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;

/**
* @author Emmanuel Bernard
*/
public class XMLContext {
-  private static Log log = LogFactory.getLog( XMLContext.class );
+  private Logger log = LoggerFactory.getLogger( XMLContext.class );
 private Default globalDefaults;
 private Map<String, Element> classOverriding = new HashMap<String, Element>();
 private Map<String, Default> defaultsOverriding = new HashMap<String, Default>();
@@(protected) @@
     if ( access != null ) localDefault.setAccess( access );
     defaultsOverriding.put( className, localDefault );

-      log.debug( "Adding XML overriding information for " + className );
+      log.debug( "Adding XML overriding information for {}", className );
     addEntityListenerClasses( element, packageName, addedClasses );
   }
 }
@@(protected) @@
         //maybe switch it to warn?
         if ( "entity-listener".equals( classOverriding.get( listenerClassName ).getName() ) ) {
           log.info(
-                "entity-listener duplication, first event definition will be used: "
-                    + listenerClassName
+                "entity-listener duplication, first event definition will be used: {}",
+                listenerClassName
           );
           continue;
         }
@@(protected) @@
       classOverriding.put( listenerClassName, listener );
     }
   }
-    log.debug( "Adding XML overriding information for listener: " + listeners );
+    log.debug( "Adding XML overriding information for listener: {}", listeners );
   addedClasses.addAll( localAddedClasses );
   return localAddedClasses;
 }

Modified: annotations/trunk/src/java/org/hibernate/cfg/search/SearchConfiguration.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/search/SearchConfiguration.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/cfg/search/SearchConfiguration.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
import org.hibernate.event.PostUpdateEventListener;
import org.hibernate.event.PostDeleteEventListener;
import org.hibernate.event.EventListeners;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;

/**
* Helper methods initializing Hibernate Search event listeners
@@(protected) @@
* @author Emmanuel Bernard
*/
public class SearchConfiguration {
-  private static Log log = LogFactory.getLog( SearchConfiguration.class );
+  private static final Logger log = LoggerFactory.getLogger( SearchConfiguration.class );

 public static void enableHibernateSearch(EventListeners eventListeners, Properties properties) {
   //add search events if the jar is available

Modified: annotations/trunk/src/java/org/hibernate/type/EnumType.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/type/EnumType.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/java/org/hibernate/type/EnumType.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
import java.util.Map;
import java.util.Properties;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException;
+import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.usertype.EnhancedUserType;
import org.hibernate.usertype.ParameterizedType;
import org.hibernate.util.ReflectHelper;
-import org.hibernate.util.StringHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

/**
* Enum type mapper
@@(protected) @@
*/
//TODO implements readobject/writeobject to recalculate the enumclasses
public class EnumType implements EnhancedUserType, ParameterizedType, Serializable {
-  private static Log log = LogFactory.getLog( EnumType.class );
-  private static final boolean IS_TRACE_ENABLED;
+  /**
+   * This is the old scheme where logging of parameter bindings and value extractions
+   * was controlled by the trace level enablement on the 'org.hibernate.type' package...
+   * <p/>
+   * Originally was cached such because of performance of looking up the logger each time
+   * in order to check the trace-enablement. Driving this via a central Log-specific class
+   * would alleviate that performance hit, and yet still allow more "normal" logging usage/config.
+   */
+  private static final boolean IS_VALUE_TRACING_ENABLED = LoggerFactory.getLogger( StringHelper.qualifier( Type.class.getName() ) ).isTraceEnabled();
+  private transient Logger log;

-  static {
-    //cache this, because it was a significant performance cost
-    IS_TRACE_ENABLED = LogFactory.getLog( StringHelper.qualifier( Type.class.getName() ) ).isTraceEnabled();
+  private Logger log() {
+    if ( log == null ) {
+      log = LoggerFactory.getLogger( getClass() );
+    }
+    return log;
 }

 public static final String ENUM = "enumClass";
@@(protected) @@
 public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {
   Object object = rs.getObject( names[0] );
   if ( rs.wasNull() ) {
-      if ( IS_TRACE_ENABLED ) {
-        log.debug( "Returning null as column " + names[0] );
+      if ( IS_VALUE_TRACING_ENABLED ) {
+        log().debug( "Returning null as column {}", names[0] );
     }
     return null;
   }
@@(protected) @@
     if ( ordinal < 0 || ordinal >= values.length ) {
       throw new IllegalArgumentException( "Unknown ordinal value for enum " + enumClass + ": " + ordinal );
     }
-      if ( IS_TRACE_ENABLED ) {
-        log.debug( "Returning '" + ordinal + "' as column " + names[0] );
+      if ( IS_VALUE_TRACING_ENABLED ) {
+        log().debug( "Returning '{}' as column {}", ordinal, names[0] );
     }
     return values[ordinal];
   }
   else {
     String name = (String) object;
-      if ( IS_TRACE_ENABLED ) {
-        log.debug( "Returning '" + name + "' as column " + names[0] );
+      if ( IS_VALUE_TRACING_ENABLED ) {
+        log().debug( "Returning '{}' as column {}", name, names[0] );
     }
     try {
       return Enum.valueOf( enumClass, name );
@@(protected) @@
 public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
   //if (!guessed) guessType( st, index );
   if ( value == null ) {
-      if ( IS_TRACE_ENABLED ) log.debug( "Binding null to parameter: " + index );
+      if ( IS_VALUE_TRACING_ENABLED ) log().debug( "Binding null to parameter: {}", index );
     st.setNull( index, sqlType );
   }
   else {
     boolean isOrdinal = isOrdinal( sqlType );
     if ( isOrdinal ) {
       int ordinal = ( (Enum) value ).ordinal();
-        if ( IS_TRACE_ENABLED ) {
-          log.debug( "Binding '" + ordinal + "' to parameter: " + index );
+        if ( IS_VALUE_TRACING_ENABLED ) {
+          log().debug( "Binding '{}' to parameter: {}", ordinal, index );
       }
       st.setObject( index, Integer.valueOf( ordinal ), sqlType );
     }
     else {
       String enumString = ( (Enum) value ).name();
-        if ( IS_TRACE_ENABLED ) {
-          log.debug( "Binding '" + enumString + "' to parameter: " + index );
+        if ( IS_VALUE_TRACING_ENABLED ) {
+          log().debug( "Binding '{}' to parameter: {}", enumString, index );
       }
       st.setObject( index, enumString, sqlType );
     }

Modified: annotations/trunk/src/test/org/hibernate/test/annotations/reflection/LogListener.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/reflection/LogListener.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/reflection/LogListener.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
import javax.persistence.PrePersist;
import javax.persistence.PostPersist;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

+
/**
* @author Emmanuel Bernard
*/
public class LogListener {
-  Log log = LogFactory.getLog( LogListener.class );
+  private final Logger log = LoggerFactory.getLogger( LogListener.class );

 @PrePersist
 @PostPersist
 public void log(Object entity) {
-    log.debug( "Logging entity " + entity.getClass().getName() + " with hashCode: " + entity.hashCode() );
+    log.debug( "Logging entity {} with hashCode: {}", entity.getClass().getName(), entity.hashCode() );
 }


 public void noLog(Object entity) {
-    log.debug( "NoLogging entity " + entity.getClass().getName() + " with hashCode: " + entity.hashCode() );
+    log.debug( "NoLogging entity {} with hashCode: {}", entity.getClass().getName(), entity.hashCode() );
 }
}

Modified: annotations/trunk/src/test/org/hibernate/test/annotations/reflection/OtherLogListener.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/reflection/OtherLogListener.java  2008-05-17 12:47:32 UTC (rev 14670)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/reflection/OtherLogListener.java  2008-05-17 12:49:38 UTC (rev 14671)
@@(protected) @@
import javax.persistence.PrePersist;
import javax.persistence.PostPersist;

-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

+
/**
* @author Emmanuel Bernard
*/
public class OtherLogListener {
-  Log log = LogFactory.getLog( OtherLogListener.class );
+  private final Logger log = LoggerFactory.getLogger( OtherLogListener.class );

 @PrePersist
 @PostPersist
 public void log(Object entity) {
-    log.debug( "Logging entity " + entity.getClass().getName() + " with hashCode: " + entity.hashCode() );
+    log.debug( "Logging entity {} with hashCode: {}", entity.getClass().getName(), entity.hashCode() );
 }


 public void noLog(Object entity) {
-    log.debug( "NoLogging entity " + entity.getClass().getName() + " with hashCode: " + entity.hashCode() );
+    log.debug( "NoLogging entity {} with hashCode: {}", entity.getClass().getName(), entity.hashCode() );
 }
}

_______________________________________________
hibernate-commits mailing list
hibernate-commits@(protected)
https://lists.jboss.org/mailman/listinfo/hibernate-commits
©2008 gg3721.com - Jax Systems, LLC, U.S.A.