HHH-5615 Replaced slf4j references with jboss-logging for a few classes that fell through the cracks

This commit is contained in:
JPAV 2011-03-22 14:11:59 -05:00
parent f93d1412a4
commit 7767dfbc06
12 changed files with 60 additions and 76 deletions

View File

@ -1854,4 +1854,8 @@ public interface HibernateLogger extends BasicLogger {
@Message( value = "Encountered legacy TransactionManagerLookup specified; convert to newer %s contract specified via %s setting", id = 428 )
void legacyTransactionManagerStrategy( String name,
String jtaPlatform );
@LogMessage( level = WARN )
@Message( value = "Setting entity-identifier value binding where one already existed : %s.", id = 429 )
void entityIdentifierValueBindingExists(String name);
}

View File

@ -24,6 +24,7 @@
package org.hibernate.engine.transaction.internal;
import org.hibernate.ConnectionReleaseMode;
import org.hibernate.HibernateLogger;
import org.hibernate.ResourceClosedException;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl;
@ -42,8 +43,7 @@ import org.hibernate.engine.transaction.synchronization.internal.Synchronization
import org.hibernate.engine.transaction.synchronization.spi.SynchronizationCallbackCoordinator;
import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.service.jta.platform.spi.JtaPlatform;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.jboss.logging.Logger;
import java.io.IOException;
import java.io.ObjectInputStream;
@ -60,7 +60,8 @@ import java.util.List;
* @author Steve Ebersole
*/
public class TransactionCoordinatorImpl implements TransactionCoordinator {
private static final Logger log = LoggerFactory.getLogger( TransactionCoordinatorImpl.class );
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, TransactionCoordinatorImpl.class.getName());
private final transient TransactionContext transactionContext;
private final transient JdbcCoordinatorImpl jdbcCoordinator;
@ -125,7 +126,7 @@ public class TransactionCoordinatorImpl implements TransactionCoordinator {
}
public void afterTransaction(TransactionImplementor hibernateTransaction, int status) {
log.trace( "after transaction completion" );
LOG.trace( "after transaction completion" );
final boolean success = JtaStatusHelper.isCommitted( status );
@ -221,19 +222,19 @@ public class TransactionCoordinatorImpl implements TransactionCoordinator {
// Can we resister a synchronization
if ( ! jtaPlatform.canRegisterSynchronization() ) {
log.trace( "registered JTA platform says we cannot currently resister synchronization; skipping" );
LOG.trace( "registered JTA platform says we cannot currently resister synchronization; skipping" );
return;
}
// Should we resister a synchronization
if ( ! transactionFactory().isJoinableJtaTransaction( this, currentHibernateTransaction ) ) {
log.trace( "TransactionFactory reported no JTA transaction to join; skipping Synchronization registration" );
LOG.trace( "TransactionFactory reported no JTA transaction to join; skipping Synchronization registration" );
return;
}
jtaPlatform.registerSynchronization( new RegisteredSynchronization( getSynchronizationCallbackCoordinator() ) );
synchronizationRegistered = true;
log.debug( "successfully registered Synchronization" );
LOG.debug( "successfully registered Synchronization" );
}
@Override
@ -245,7 +246,7 @@ public class TransactionCoordinatorImpl implements TransactionCoordinator {
}
public void pulse() {
log.trace( "Starting transaction coordinator pulse" );
LOG.trace( "Starting transaction coordinator pulse" );
if ( transactionFactory().compatibleWithJtaSynchronization() ) {
// the configured transaction strategy says it supports callbacks via JTA synchronization, so attempt to
// register JTA synchronization if possible

View File

@ -23,8 +23,8 @@
*/
package org.hibernate.metamodel.binding;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.HibernateLogger;
import org.jboss.logging.Logger;
/**
* TODO : javadoc
@ -32,7 +32,8 @@ import org.slf4j.LoggerFactory;
* @author Steve Ebersole
*/
public class EntityIdentifier {
private static final Logger log = LoggerFactory.getLogger( EntityIdentifier.class );
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, EntityIdentifier.class.getName());
private final EntityBinding entityBinding;
private AttributeBinding attributeBinding;
@ -53,7 +54,7 @@ public class EntityIdentifier {
public void setValueBinding(AttributeBinding attributeBinding) {
if ( this.attributeBinding != null ) {
// todo : error? or just log? for now just log
log.warn( "setting entity-identifier value binding where one already existed : {}.", entityBinding.getEntity().getName() );
LOG.entityIdentifierValueBindingExists( entityBinding.getEntity().getName() );
}
this.attributeBinding = attributeBinding;
}

View File

@ -23,10 +23,9 @@
*/
package org.hibernate.metamodel.relational;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.HibernateLogger;
import org.hibernate.metamodel.ValidationException;
import org.jboss.logging.Logger;
/**
* Basic support for {@link SimpleValue} implementations.
@ -34,7 +33,8 @@ import org.hibernate.metamodel.ValidationException;
* @author Steve Ebersole
*/
public abstract class AbstractSimpleValue implements SimpleValue {
private static final Logger log = LoggerFactory.getLogger( AbstractSimpleValue.class );
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, AbstractSimpleValue.class.getName());
private final TableSpecification table;
private final int position;
@ -61,9 +61,9 @@ public abstract class AbstractSimpleValue implements SimpleValue {
@Override
public void setDatatype(Datatype datatype) {
log.debug( "setting datatype for column {} : {}", toLoggableString(), datatype );
LOG.debugf( "setting datatype for column %s : %s", toLoggableString(), datatype );
if ( this.datatype != null && ! this.datatype.equals( datatype ) ) {
log.debug( "overriding previous datatype : {}", this.datatype );
LOG.debugf( "overriding previous datatype : %s", this.datatype );
}
this.datatype = datatype;
}

View File

@ -26,8 +26,9 @@ package org.hibernate.metamodel.relational;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.HibernateLogger;
import org.jboss.logging.Logger;
import org.jboss.logging.Logger.Level;
/**
* Models the notion of a foreign key.
@ -39,7 +40,8 @@ import org.slf4j.LoggerFactory;
* @author Steve Ebersole
*/
public class ForeignKey extends AbstractConstraint implements Constraint, Exportable {
private static final Logger log = LoggerFactory.getLogger( ForeignKey.class );
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, AbstractConstraint.class.getName());
private final TableSpecification targetTable;
private List<Column> targetColumns;
@ -81,24 +83,12 @@ public class ForeignKey extends AbstractConstraint implements Constraint, Export
public void addColumnMapping(Column sourceColumn, Column targetColumn) {
if ( targetColumn == null ) {
if ( targetColumns != null ) {
if ( log.isWarnEnabled() ) {
log.warn(
"Attempt to map column [" + sourceColumn.toLoggableString()
+ "] to no target column after explicit target column(s) named for FK [name="
+ getName() + "]"
);
}
if (LOG.isEnabled(Level.WARN)) LOG.attemptToMapColumnToNoTargetColumn(sourceColumn.toLoggableString(), getName());
}
}
else {
if ( targetColumns == null ) {
if ( !internalColumnAccess().isEmpty() ) {
log.warn(
"Value mapping mismatch as part of FK [table=" + getTable().toLoggableString()
+ ", name=" + getName() + "] while adding source column ["
+ sourceColumn.toLoggableString() + "]"
);
}
if (!internalColumnAccess().isEmpty()) LOG.valueMappingMismatch(getTable().toLoggableString(), getName(), sourceColumn.toLoggableString());
targetColumns = new ArrayList<Column>();
}
targetColumns.add( targetColumn );

View File

@ -28,12 +28,11 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.HibernateLogger;
import org.hibernate.MappingException;
import org.hibernate.cfg.ExtendsQueueEntry;
import org.hibernate.metamodel.source.hbm.HbmHelper;
import org.jboss.logging.Logger;
/**
* TODO : javadoc
@ -41,7 +40,8 @@ import org.hibernate.metamodel.source.hbm.HbmHelper;
* @author Steve Ebersole
*/
public class ExtendsQueue implements Serializable {
private static final Logger log = LoggerFactory.getLogger( ExtendsQueue.class );
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, ExtendsQueue.class.getName());
private final Metadata metadata;
private Set<ExtendsQueueEntry> extendsQueue = new HashSet<ExtendsQueueEntry>();
@ -55,7 +55,7 @@ public class ExtendsQueue implements Serializable {
}
public int processExtendsQueue() {
log.debug( "processing extends queue" );
LOG.debug( "processing extends queue" );
int added = 0;
ExtendsQueueEntry extendsQueueEntry = findPossibleExtends();
while ( extendsQueueEntry != null ) {

View File

@ -29,10 +29,8 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.DuplicateMappingException;
import org.hibernate.HibernateLogger;
import org.hibernate.annotations.common.reflection.MetadataProvider;
import org.hibernate.annotations.common.reflection.MetadataProviderInjector;
import org.hibernate.annotations.common.reflection.ReflectionManager;
@ -46,6 +44,7 @@ import org.hibernate.metamodel.binding.EntityBinding;
import org.hibernate.metamodel.binding.PluralAttributeBinding;
import org.hibernate.metamodel.relational.Database;
import org.hibernate.metamodel.source.hbm.HibernateXmlBinder;
import org.jboss.logging.Logger;
/**
* TODO : javadoc
@ -53,7 +52,8 @@ import org.hibernate.metamodel.source.hbm.HibernateXmlBinder;
* @author Steve Ebersole
*/
public class Metadata implements Serializable {
private static final Logger log = LoggerFactory.getLogger( Metadata.class );
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, Metadata.class.getName());
private final HibernateXmlBinder hibernateXmlBinder = new HibernateXmlBinder( this );
private final ExtendsQueue extendsQueue = new ExtendsQueue( this );
@ -151,10 +151,10 @@ public class Metadata implements Serializable {
if ( imports == null ) {
imports = new HashMap<String, String>();
}
log.trace( "Import: " + importName + " -> " + entityName );
LOG.tracef( "Import: %s -> %s", importName, entityName );
String old = imports.put( importName, entityName );
if ( old != null ) {
log.debug( "import name [{}] overrode previous [{}]", importName, old );
LOG.debugf( "import name [%s] overrode previous [%s]", importName, old );
}
}

View File

@ -39,15 +39,15 @@ import javax.persistence.Entity;
import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.HibernateLogger;
import org.hibernate.InvalidMappingException;
import org.hibernate.MappingException;
import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.cfg.MetadataSourceType;
import org.hibernate.internal.util.collections.JoinedIterator;
import org.hibernate.internal.util.xml.XmlDocument;
import org.jboss.logging.Logger;
/**
* TODO : javadoc
@ -55,7 +55,9 @@ import org.hibernate.internal.util.xml.XmlDocument;
* @author Steve Ebersole
*/
public class MetadataSourceQueue implements Serializable {
private static final Logger log = LoggerFactory.getLogger( MetadataSourceQueue.class );
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, MetadataSourceQueue.class.getName());
private final Metadata metadata;
private LinkedHashMap<XmlDocument, Set<String>> hbmMetadataToEntityNamesMap
@ -174,7 +176,7 @@ public class MetadataSourceQueue implements Serializable {
}
private void processHbmXmlQueue() {
log.debug( "Processing hbm.xml files" );
LOG.debug( "Processing hbm.xml files" );
for ( Map.Entry<XmlDocument, Set<String>> entry : hbmMetadataToEntityNamesMap.entrySet() ) {
// Unfortunately we have to create a Mappings instance for each iteration here
processHbmXml( entry.getKey(), entry.getValue() );
@ -204,7 +206,7 @@ public class MetadataSourceQueue implements Serializable {
}
private void processAnnotatedClassesQueue() {
log.debug( "Process annotated classes" );
LOG.debug( "Process annotated classes" );
//bind classes in the correct order calculating some inheritance state
List<XClass> orderedClasses = orderAndFillHierarchy( annotatedClasses );
// Map<XClass, InheritanceState> inheritanceStatePerClass = AnnotationBinder.buildInheritanceStates(

View File

@ -32,8 +32,6 @@ import java.util.StringTokenizer;
import org.dom4j.Attribute;
import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.EntityMode;
import org.hibernate.MappingException;
@ -71,7 +69,6 @@ import org.hibernate.metamodel.source.util.DomHelper;
* @author Steve Ebersole
*/
abstract class AbstractEntityBinder {
private static final Logger log = LoggerFactory.getLogger( AbstractEntityBinder.class );
protected final HibernateMappingBinder hibernateMappingBinder;
protected final Map<String, MetaAttribute> entityMetas;

View File

@ -22,6 +22,7 @@
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.filter;
import static org.hibernate.testing.TestLogger.LOG;
import java.util.ArrayList;
import java.util.Calendar;
@ -31,9 +32,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.Criteria;
import org.hibernate.EntityMode;
import org.hibernate.FetchMode;
@ -67,7 +65,6 @@ import static org.junit.Assert.assertTrue;
* @author Steve Ebersole
*/
public class DynamicFilterTest extends BaseCoreFunctionalTestCase {
private Logger log = LoggerFactory.getLogger( DynamicFilterTest.class );
@Override
public String[] getMappings() {
@ -218,7 +215,7 @@ public class DynamicFilterTest extends BaseCoreFunctionalTestCase {
session.close();
testData.release();
}
@Test
public void testFiltersWithCustomerReadAndWrite() {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -31,9 +31,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.Query;
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
@ -62,7 +59,6 @@ import static org.junit.Assert.assertTrue;
@SuppressWarnings( {"UnnecessaryUnboxing", "UnnecessaryBoxing"})
public class SQLFunctionsTest extends LegacyTestCase {
private static final Logger log = LoggerFactory.getLogger(SQLFunctionsTest.class);
@Override
public String[] getMappings() {

View File

@ -23,29 +23,26 @@
*/
package org.hibernate.testing.junit4;
import static org.hibernate.testing.TestLogger.LOG;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.dialect.Dialect;
import org.hibernate.internal.util.StringHelper;
import org.junit.Ignore;
import org.junit.runner.manipulation.NoTestsRemainException;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.Statement;
import org.hibernate.testing.DialectCheck;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.Skip;
import org.hibernate.testing.SkipForDialect;
import org.junit.Ignore;
import org.junit.runner.manipulation.NoTestsRemainException;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.Statement;
/**
* The Hibernate-specific {@link org.junit.runner.Runner} implementation which layers {@link ExtendedFrameworkMethod}
@ -55,7 +52,6 @@ import org.hibernate.testing.SkipForDialect;
* @author Steve Ebersole
*/
public class CustomRunner extends BlockJUnit4ClassRunner {
private static final Logger log = LoggerFactory.getLogger( CustomRunner.class );
private TestClassMetadata testClassMetadata;
@ -144,7 +140,7 @@ public class CustomRunner extends BlockJUnit4ClassRunner {
}
testCount++;
log.trace( "adding test " + Helper.extractTestName( frameworkMethod ) + " [#" + testCount + "]" );
LOG.trace( "adding test " + Helper.extractTestName( frameworkMethod ) + " [#" + testCount + "]" );
result.add( new ExtendedFrameworkMethod( frameworkMethod, virtualIgnore, failureExpected ) );
}
return result;