Have a look at:
http://www.hibernate.org/hib_docs/v...sion-configuration.html#configuration-logging
In your log4j properties file you could do:
log4j.logger.org.hibernate=error
but it's a good idea to keep the SQL:
log4j.logger.org.hibernate.SQL=debug
I'm still getting all sorts of crap: my log4j.properties contains
### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=error, stdout
log4j.logger.org.hibernate=error
but I still get
Sep 26, 2006 7:23:45 AM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.0.5
Sep 26, 2006 7:23:45 AM org.hibernate.cfg.Environment <clinit>
INFO: loaded properties from resource hibernate.properties: {hibernate.cglib.use_reflection_optimizer=true}
Sep 26, 2006 7:23:45 AM org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Sep 26, 2006 7:23:45 AM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Sep 26, 2006 7:23:45 AM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Sep 26, 2006 7:23:45 AM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Sep 26, 2006 7:23:45 AM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: com/stevesobol/gallery/Photo.hbm.xml
Sep 26, 2006 7:23:46 AM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: com.stevesobol.gallery.Photo -> photos
Sep 26, 2006 7:23:46 AM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Sep 26, 2006 7:23:46 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing extends queue
Sep 26, 2006 7:23:46 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing collection mappings
Sep 26, 2006 7:23:46 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing association property references
Sep 26, 2006 7:23:46 AM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
Sep 26, 2006 7:23:46 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Sep 26, 2006 7:23:46 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
Sep 26, 2006 7:23:46 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
Sep 26, 2006 7:23:46 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: org.gjt.mm.mysql.Driver at URL: jdbc:mysql://amethyst.justthe.net/gallery
Sep 26, 2006 7:23:46 AM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=sjsobol, password=****}
Sep 26, 2006 7:23:47 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: MySQL, version: 4.0.26-Max
Sep 26, 2006 7:23:47 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.10 ( $Date: 2005/05/19 15:52:23 $, $Revision: 1.1.2.2 $ )
Sep 26, 2006 7:23:47 AM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLDialect
Sep 26, 2006 7:23:47 AM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
Sep 26, 2006 7:23:47 AM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
Sep 26, 2006 7:23:47 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
Sep 26, 2006 7:23:47 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
Sep 26, 2006 7:23:47 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
Sep 26, 2006 7:23:47 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
Sep 26, 2006 7:23:47 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
Sep 26, 2006 7:23:47 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): enabled
Sep 26, 2006 7:23:47 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: null
Sep 26, 2006 7:23:47 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 2
Sep 26, 2006 7:23:47 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
Sep 26, 2006 7:23:48 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
Sep 26, 2006 7:23:48 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
Sep 26, 2006 7:23:48 AM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Sep 26, 2006 7:23:48 AM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
Sep 26, 2006 7:23:48 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Sep 26, 2006 7:23:48 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
Sep 26, 2006 7:23:48 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
Sep 26, 2006 7:23:48 AM org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.EhCacheProvider
Sep 26, 2006 7:23:48 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
Sep 26, 2006 7:23:48 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
Sep 26, 2006 7:23:48 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
Sep 26, 2006 7:23:48 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
Sep 26, 2006 7:23:48 AM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
Sep 26, 2006 7:23:48 AM org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Sep 26, 2006 7:23:48 AM net.sf.ehcache.config.Configurator configure
WARNING: No configuration found. Configuring ehcache from ehcache -failsafe.xml found in the classpath: jar:file:/C:/Data/@Common/lib/ehcache-1.2beta1.jar!/ehcache-failsafe.xml
Sep 26, 2006 7:23:49 AM org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
Sep 26, 2006 7:23:49 AM org.hibernate.impl.SessionFactoryImpl checkNamedQueries
INFO: Checking 0 named queries
I'm new to log4j. Do I have to separately configure each class doing logging?
(I'm trying that too, and it doesn't seem to work)