Re: Hibernate over-verbose logging



Hi Steven

The answer to you question lies in the log4j.properties file.

In the file you tell the logger the level of logging. These are :
DEBUG, INFO, WARN, ERROR, FATAL.
The verbousness dercreases from rigth to left on this list.

I was able to get almos everything away, when I changed "info" to
"fatal"

Hope this helsp you

-jukkaT-

Here is my changed file:


### direct messages to file hibernate.log ###
#log4j.appender.file=org.apache.log4j.FileAppender
#log4j.appender.file.File=hibernate.log
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L
- %m%n

### set log levels - for more verbose logging change 'info' to 'debug'
###

log4j.rootLogger=warn, stdout

log4j.logger.org.hibernate=fatal
#log4j.logger.org.hibernate=debug

### log HQL query parser activity
#log4j.logger.org.hibernate.hql.ast.AST=debug

### log just the SQL
#log4j.logger.org.hibernate.SQL=debug

### log JDBC bind parameters ###
log4j.logger.org.hibernate.type=info
#log4j.logger.org.hibernate.type=debug

### log schema export/update ###
log4j.logger.org.hibernate.tool.hbm2ddl=debug

### log HQL parse trees
#log4j.logger.org.hibernate.hql=debug

### log cache activity ###
#log4j.logger.org.hibernate.cache=debug

### log transaction activity
#log4j.logger.org.hibernate.transaction=debug

### log JDBC resource acquisition
#log4j.logger.org.hibernate.jdbc=debug

### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace


Steven J. Sobol kirjoitti:

In article <1159252882.690357.207510@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, Jean-Francois Briere wrote:
Have a look at:
http://www.hibernate.org/hib_docs/v3/reference/en/html/session-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)


Regards



--
Steve Sobol, Professional Geek ** Java/VB/VC/PHP/Perl ** Linux/*BSD/Windows
Apple Valley, California PGP:0xE3AE35ED

It's all fun and games until someone starts a bonfire in the living room.

.



Relevant Pages

  • [PATCH 02/16] DRBD: lru_cache
    ... The lru_cache is a fixed size cache of equal sized objects. ... bitmap, or other meta data. ... For each transaction recording a change to the active set, ... the lru cache to operate on ...
    (Linux-Kernel)
  • Identity range problem...
    ... We have an application that use an archive / cache concept: ... creation of an invoice, the transactions are store in a table Cache. ... Each transaction has an unique ID int. ... Because of replication, the article Cache was published using the identity ...
    (microsoft.public.sqlserver.replication)
  • Re: [PATCH] Fix bad data from non-direct-io read after direct-io write
    ... commits the transaction. ... ->releasepage if jbd is committing the transaction. ... page cache while dio holds a page reference. ...
    (Linux-Kernel)
  • Re: Memory Sizing Advice
    ... The working set of indexes simply don't fit in cache all that well. ... that you're acting as though cache memory isn't an analagous ... Oracle restricts block cleanout for a transaction of any size to 10% ...
    (comp.databases.oracle.server)
  • Re: Internet Gets slow
    ... I'd also recommend configuring the HTTP ... redirector to not redirect to the Web Proxy Service, ... you're accessing the cache. ... Personally, I've had good results Caching, ...
    (microsoft.public.isa)