HHH-6097 - Review log levels, especially related to i18n messages

This commit is contained in:
Steve Ebersole 2011-04-12 09:07:31 -05:00
parent 62da5aa5bc
commit ad17f89c4c
12 changed files with 55 additions and 148 deletions

View File

@ -517,7 +517,7 @@ public final class AnnotationBinder {
return;
}
LOG.bindingEntityFromClass( clazzToProcess.getName() );
LOG.debugf( "Binding entity from annotated class: %s", clazzToProcess.getName() );
PersistentClass superEntity = getSuperEntity(
clazzToProcess, inheritanceStatePerClass, mappings, inheritanceState
@ -1234,7 +1234,7 @@ public final class AnnotationBinder {
params.put( param.name(), mappings.getTypeResolver().heuristicType( param.type() ) );
}
FilterDefinition def = new FilterDefinition( defAnn.name(), defAnn.defaultCondition(), params );
LOG.bindingFilterDefinition( def.getFilterName() );
LOG.debugf( "Binding filter definition: %s", def.getFilterName() );
mappings.addFilterDefinition( def );
}
@ -1289,12 +1289,13 @@ public final class AnnotationBinder {
);
}
final String typeBindMessageF = "Binding type definition: %s";
if ( !BinderHelper.isEmptyAnnotationValue( defAnn.name() ) ) {
LOG.bindingTypeDefinition( defAnn.name() );
LOG.debugf( typeBindMessageF, defAnn.name() );
mappings.addTypeDef( defAnn.name(), defAnn.typeClass().getName(), params );
}
if ( !defAnn.defaultForType().equals( void.class ) ) {
LOG.bindingTypeDefinition( defAnn.defaultForType().getName() );
LOG.debugf( typeBindMessageF, defAnn.defaultForType().getName() );
mappings.addTypeDef( defAnn.defaultForType().getName(), defAnn.typeClass().getName(), params );
}

View File

@ -638,7 +638,7 @@ public class BinderHelper {
private static void bindAnyMetaDef(AnyMetaDef defAnn, Mappings mappings) {
if ( isEmptyAnnotationValue( defAnn.name() ) ) return; //don't map not named definitions
LOG.bindingAnyMetaDefinition( defAnn.name() );
LOG.debugf( "Binding Any Meta definition: %s", defAnn.name() );
mappings.addAnyMetaDef( defAnn );
}

View File

@ -767,7 +767,7 @@ public class Configuration implements Serializable {
* @throws MappingException in case there is an error in the mapping data
*/
public Configuration addPackage(String packageName) throws MappingException {
LOG.mappingPackage(packageName);
LOG.debugf( "Mapping Package %s", packageName );
try {
AnnotationBinder.bindPackage( packageName, createMappings() );
return this;

View File

@ -26,7 +26,6 @@ package org.hibernate.cfg;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.Iterator;
@ -614,7 +613,7 @@ public final class Environment {
LOG.propertiesLoaded(ConfigurationHelper.maskOut(GLOBAL_PROPERTIES, PASS));
}
catch (Exception e) {
LOG.unableToloadProperties();
LOG.unableToLoadProperties();
}
finally {
try{

View File

@ -29,20 +29,23 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Properties;
import java.util.StringTokenizer;
import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.Element;
import org.jboss.logging.Logger;
import org.hibernate.CacheMode;
import org.hibernate.EntityMode;
import org.hibernate.FetchMode;
import org.hibernate.FlushMode;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.MappingException;
import org.hibernate.engine.ExecuteUpdateResultCheckStyle;
import org.hibernate.engine.FilterDefinition;
import org.hibernate.engine.NamedQueryDefinition;
import org.hibernate.engine.Versioning;
import org.hibernate.id.PersistentIdentifierGenerator;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.collections.JoinedIterator;
@ -97,7 +100,6 @@ import org.hibernate.persister.entity.UnionSubclassEntityPersister;
import org.hibernate.type.DiscriminatorType;
import org.hibernate.type.ForeignKeyDirection;
import org.hibernate.type.Type;
import org.jboss.logging.Logger;
/**
* Walks an XML mapping document and produces the Hibernate configuration-time metamodel (the
@ -345,7 +347,7 @@ public final class HbmBinder {
entity.setTable( table );
bindComment(table, node);
LOG.mappingClass(entity.getEntityName(), entity.getTable().getName());
LOG.debugf( "Mapping class: %s -> %s", entity.getEntityName(), entity.getTable().getName() );
// MUTABLE
Attribute mutableNode = node.attribute( "mutable" );
@ -843,7 +845,9 @@ public final class HbmBinder {
);
unionSubclass.setTable( mytable );
LOG.mappingUnionSubclass(unionSubclass.getEntityName(), unionSubclass.getTable().getName());
LOG.debugf(
"Mapping union-subclass: %s -> %s", unionSubclass.getEntityName(), unionSubclass.getTable().getName()
);
createClassProperties( node, unionSubclass, mappings, inheritedMetas );
@ -860,16 +864,19 @@ public final class HbmBinder {
.setEntityPersisterClass( SingleTableEntityPersister.class );
}
LOG.mappingSubclass(subclass.getEntityName(), subclass.getTable().getName());
LOG.debugf( "Mapping subclass: %s -> %s", subclass.getEntityName(), subclass.getTable().getName() );
// properties
createClassProperties( node, subclass, mappings, inheritedMetas );
}
private static String getClassTableName(
PersistentClass model, Element node, String schema, String catalog, Table denormalizedSuperTable,
Mappings mappings
) {
PersistentClass model,
Element node,
String schema,
String catalog,
Table denormalizedSuperTable,
Mappings mappings) {
Attribute tableNameNode = node.attribute( "table" );
String logicalTableName;
String physicalTableName;
@ -916,7 +923,9 @@ public final class HbmBinder {
joinedSubclass.setTable( mytable );
bindComment(mytable, node);
LOG.mappingJoinedSubclass(joinedSubclass.getEntityName(), joinedSubclass.getTable().getName());
LOG.debugf(
"Mapping joined-subclass: %s -> %s", joinedSubclass.getEntityName(), joinedSubclass.getTable().getName()
);
// KEY
Element keyNode = node.element( "key" );
@ -979,7 +988,7 @@ public final class HbmBinder {
}
LOG.mappingClassJoin(persistentClass.getEntityName(), join.getTable().getName());
LOG.debugf( "Mapping class join: %s -> %s", persistentClass.getEntityName(), join.getTable().getName() );
// KEY
Element keyNode = node.element( "key" );
@ -1470,7 +1479,9 @@ public final class HbmBinder {
collection.setCollectionTable( table );
bindComment(table, node);
LOG.mappingCollection(collection.getRole(), collection.getCollectionTable().getName());
LOG.debugf(
"Mapping collection: %s -> %s", collection.getRole(), collection.getCollectionTable().getName()
);
}
// SORT
@ -2453,7 +2464,9 @@ public final class HbmBinder {
oneToMany.setAssociatedClass( persistentClass );
collection.setCollectionTable( persistentClass.getTable() );
LOG.mappingCollection(collection.getRole(), collection.getCollectionTable().getName());
LOG.debugf(
"Mapping collection: %s -> %s", collection.getRole(), collection.getCollectionTable().getName()
);
}
// CHECK

View File

@ -746,7 +746,7 @@ public abstract class CollectionBinder {
column.setJoins( joins );
collection.setCollectionTable( column.getTable() );
}
LOG.mappingCollection(collection.getRole(), collection.getCollectionTable().getName());
LOG.debugf( "Mapping collection: %s -> %s", collection.getRole(), collection.getCollectionTable().getName() );
bindFilters( false );
bindCollectionSecondPass( collection, null, fkJoinColumns, cascadeDeleteEnabled, property, mappings );
if ( !collection.isInverse()

View File

@ -516,7 +516,7 @@ public class EntityBinder {
}
if ( persistentClass instanceof TableOwner ) {
LOG.bindEntityOnTable( persistentClass.getEntityName(), table.getName() );
LOG.debugf( "Bind entity %s on table %s", persistentClass.getEntityName(), table.getName() );
( (TableOwner) persistentClass ).setTable( table );
}
else {

View File

@ -81,7 +81,7 @@ public abstract class QueryBinder {
else {
mappings.addQuery( queryAnn.name(), query );
}
LOG.bindingNamedQuery( queryAnn.name(), queryAnn.query() );
LOG.debugf( "Binding named query: %s => %s", queryAnn.name(), queryAnn.query() );
}
@ -142,7 +142,7 @@ public abstract class QueryBinder {
else {
mappings.addSQLQuery( queryAnn.name(), query );
}
LOG.bindingNamedNativeQuery( queryAnn.name(), queryAnn.query() );
LOG.debugf( "Binding named native query: %s => %s", queryAnn.name(), queryAnn.query() );
}
public static void bindNativeQuery(org.hibernate.annotations.NamedNativeQuery queryAnn, Mappings mappings) {
@ -195,7 +195,7 @@ public abstract class QueryBinder {
throw new NotYetImplementedException( "Pure native scalar queries are not yet supported" );
}
mappings.addSQLQuery( queryAnn.name(), query );
LOG.bindingNamedNativeQuery( queryAnn.name(), queryAnn.query() );
LOG.debugf( "Binding named native query: %s => %s", queryAnn.name(), queryAnn.query() );
}
public static void bindQueries(NamedQueries queriesAnn, Mappings mappings, boolean isDefault) {
@ -242,7 +242,7 @@ public abstract class QueryBinder {
);
mappings.addQuery( queryAnn.name(), query );
LOG.bindingNamedQuery( queryAnn.name(), queryAnn.query() );
LOG.debugf( "Binding named query: %s => %s", queryAnn.name(), queryAnn.query() );
}
private static FlushMode getFlushMode(FlushModeType flushModeType) {

View File

@ -73,7 +73,7 @@ public class ResultsetMappingSecondPass implements QuerySecondPass {
//TODO add parameters checkings
if ( ann == null ) return;
ResultSetMappingDefinition definition = new ResultSetMappingDefinition( ann.name() );
LOG.bindingResultSetMapping( definition.getName() );
LOG.debugf( "Binding result set mapping: %s", definition.getName() );
int entityAliasIndex = 0;

View File

@ -113,15 +113,19 @@ public class JdbcServicesImpl implements JdbcServices, ServiceRegistryAwareServi
Connection connection = jdbcConnectionAccess.obtainConnection();
try {
DatabaseMetaData meta = connection.getMetaData();
LOG.database(meta.getDatabaseProductName(),
meta.getDatabaseProductVersion(),
meta.getDatabaseMajorVersion(),
meta.getDatabaseMinorVersion());
LOG.driver(meta.getDriverName(),
meta.getDriverVersion(),
meta.getDriverMajorVersion(),
meta.getDriverMinorVersion());
LOG.jdbcVersion(meta.getJDBCMajorVersion(), meta.getJDBCMinorVersion());
LOG.debugf( "Database ->\n" + " name : %s\n" + " version : %s\n" + " major : %s\n" + " minor : %s",
meta.getDatabaseProductName(),
meta.getDatabaseProductVersion(),
meta.getDatabaseMajorVersion(),
meta.getDatabaseMinorVersion()
);
LOG.debugf( "Driver ->\n" + " name : %s\n" + " version : %s\n" + " major : %s\n" + " minor : %s",
meta.getDriverName(),
meta.getDriverVersion(),
meta.getDriverMajorVersion(),
meta.getDriverMinorVersion()
);
LOG.debugf( "JDBC version : %s.%s", meta.getJDBCMajorVersion(), meta.getJDBCMinorVersion() );
metaSupportsScrollable = meta.supportsResultSetType( ResultSet.TYPE_SCROLL_INSENSITIVE );
metaSupportsBatchUpdates = meta.supportsBatchUpdates();

View File

@ -211,7 +211,7 @@ public final class SessionFactoryImpl
ServiceRegistry serviceRegistry,
Settings settings,
SessionFactoryObserver observer) throws HibernateException {
LOG.buildingSessionFactory();
LOG.debug( "Building session factory" );
this.settings = settings;
this.interceptor = cfg.getInterceptor();

View File

@ -87,45 +87,6 @@ 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 = "Bind entity %s on table %s", id = 12 )
void bindEntityOnTable( String entity,
String table );
@LogMessage( level = INFO )
@Message( value = "Binding Any Meta definition: %s", id = 13 )
void bindingAnyMetaDefinition( String name );
@LogMessage( level = INFO )
@Message( value = "Binding entity from annotated class: %s", id = 14 )
void bindingEntityFromClass( String className );
@LogMessage( level = INFO )
@Message( value = "Binding filter definition: %s", id = 15 )
void bindingFilterDefinition( String name );
@LogMessage( level = INFO )
@Message( value = "Binding named native query: %s => %s", id = 16 )
void bindingNamedNativeQuery( String name,
String query );
@LogMessage( level = INFO )
@Message( value = "Binding named query: %s => %s", id = 17 )
void bindingNamedQuery( String name,
String query );
@LogMessage( level = INFO )
@Message( value = "Binding result set mapping: %s", id = 18 )
void bindingResultSetMapping( String mapping );
@LogMessage( level = INFO )
@Message( value = "Binding type definition: %s", id = 19 )
void bindingTypeDefinition( String name );
@LogMessage( level = INFO )
@Message( value = "Building session factory", id = 20 )
void buildingSessionFactory();
@LogMessage( level = INFO )
@Message( value = "Bytecode provider name : %s", id = 21 )
void bytecodeProvider( String provider );
@ -231,21 +192,10 @@ public interface CoreMessageLogger extends BasicLogger {
@Message( value = "Creating subcontext: %s", id = 53 )
void creatingSubcontextInfo( String intermediateContextName );
@LogMessage( level = INFO )
@Message( value = "Database ->\n" + " name : %s\n" + " version : %s\n" + " major : %s\n" + " minor : %s", id = 54 )
void database( String databaseProductName,
String databaseProductVersion,
int databaseMajorVersion,
int databaseMinorVersion );
@LogMessage( level = WARN )
@Message( value = "Defining %s=true ignored in HEM", id = 59 )
void definingFlushBeforeCompletionIgnoredInHem( String flushBeforeCompletion );
@LogMessage( level = WARN )
@Message( value = "Per HHH-5451 support for cglib as a bytecode provider has been deprecated.", id = 61 )
void deprecated();
@LogMessage( level = WARN )
@Message( value = "@ForceDiscriminator is deprecated use @DiscriminatorOptions instead.", id = 62 )
void deprecatedForceDescriminatorAnnotation();
@ -267,13 +217,6 @@ public interface CoreMessageLogger extends BasicLogger {
@Message( value = "Disallowing insert statement comment for select-identity due to Oracle driver bug", id = 67 )
void disallowingInsertStatementComment();
@LogMessage( level = INFO )
@Message( value = "Driver ->\n" + " name : %s\n" + " version : %s\n" + " major : %s\n" + " minor : %s", id = 68 )
void driver( String driverProductName,
String driverProductVersion,
int driverMajorVersion,
int driverMinorVersion );
@LogMessage( level = WARN )
@Message( value = "Duplicate generator name %s", id = 69 )
void duplicateGeneratorName( String name );
@ -570,11 +513,6 @@ public interface CoreMessageLogger extends BasicLogger {
@Message( value = "JDBC URL was not specified by property %s", id = 152 )
String jdbcUrlNotSpecified( String url );
@LogMessage( level = INFO )
@Message( value = "JDBC version : %s.%s", id = 153 )
void jdbcVersion( int jdbcMajorVersion,
int jdbcMinorVersion );
@LogMessage( level = INFO )
@Message( value = "JNDI InitialContext properties:%s", id = 154 )
void jndiInitialContextProperties( Hashtable hash );
@ -608,40 +546,6 @@ public interface CoreMessageLogger extends BasicLogger {
@Message( value = "Logical connection releasing its physical connection", id = 163 )
void logicalConnectionReleasingPhysicalConnection();
@LogMessage( level = INFO )
@Message( value = "Mapping class: %s -> %s", id = 165 )
void mappingClass( String entityName,
String name );
@LogMessage( level = INFO )
@Message( value = "Mapping class join: %s -> %s", id = 166 )
void mappingClassJoin( String entityName,
String name );
@LogMessage( level = INFO )
@Message( value = "Mapping collection: %s -> %s", id = 167 )
void mappingCollection( String name1,
String name2 );
@LogMessage( level = INFO )
@Message( value = "Mapping joined-subclass: %s -> %s", id = 168 )
void mappingJoinedSubclass( String entityName,
String name );
@LogMessage( level = INFO )
@Message( value = "Mapping Package %s", id = 169 )
void mappingPackage( String packageName );
@LogMessage( level = INFO )
@Message( value = "Mapping subclass: %s -> %s", id = 170 )
void mappingSubclass( String entityName,
String name );
@LogMessage( level = INFO )
@Message( value = "Mapping union-subclass: %s -> %s", id = 171 )
void mappingUnionSubclass( String entityName,
String name );
@LogMessage( level = INFO )
@Message( value = "Max query time: %sms", id = 173 )
void maxQueryTime( long queryExecutionMaxTime );
@ -1173,10 +1077,6 @@ public interface CoreMessageLogger extends BasicLogger {
void unableToExecuteResolver( AbstractDialectResolver abstractDialectResolver,
String message );
@LogMessage( level = INFO )
@Message( value = "Unable to find %s on the classpath. Hibernate Search is not enabled.", id = 317 )
void unableToFindListenerClass( String className );
@LogMessage( level = INFO )
@Message( value = "Could not find any META-INF/persistence.xml file in the classpath", id = 318 )
void unableToFindPersistenceXmlInClasspath();
@ -1190,20 +1090,10 @@ public interface CoreMessageLogger extends BasicLogger {
void unableToInstantiateConfiguredSchemaNameResolver( String resolverClassName,
String message );
@LogMessage( level = WARN )
@Message( value = "Could not instantiate dialect resolver class : %s", id = 321 )
void unableToInstantiateDialectResolver( String message );
@LogMessage( level = WARN )
@Message( value = "Unable to instantiate specified optimizer [%s], falling back to noop", id = 322 )
void unableToInstantiateOptimizer( String type );
@Message( value = "Failed to instantiate TransactionFactory", id = 323 )
String unableToInstantiateTransactionFactory();
@Message( value = "Failed to instantiate TransactionManagerLookup '%s'", id = 324 )
String unableToInstantiateTransactionManagerLookup( String tmLookupClass );
@LogMessage( level = WARN )
@Message( value = "Unable to instantiate UUID generation strategy class : %s", id = 325 )
void unableToInstantiateUuidGenerationStrategy( Exception ignore );
@ -1222,7 +1112,7 @@ public interface CoreMessageLogger extends BasicLogger {
@LogMessage( level = ERROR )
@Message( value = "Problem loading properties from hibernate.properties", id = 329 )
void unableToloadProperties();
void unableToLoadProperties();
@Message( value = "Unable to locate config file: %s", id = 330 )
String unableToLocateConfigFile( String path );