Hibernate over-verbose logging

Discussion in 'Java' started by Steven J. Sobol, Sep 26, 2006.

  1. Is there any way to disable logging in Hibernate? A lot of what is logged is
    useless to me...


    --
    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.
    Steven J. Sobol, Sep 26, 2006
    #1
    1. Advertising

  2. Jean-Francois Briere, Sep 26, 2006
    #2
    1. Advertising

  3. In article <>, Jean-Francois Briere wrote:
    > 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)


    > 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.
    Steven J. Sobol, Sep 26, 2006
    #3
  4. Steven J. Sobol

    Guest

    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 <>, Jean-Francois Briere wrote:
    > > 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)
    >
    >
    > > 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.
    , Sep 27, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ilias Lazaridis
    Replies:
    0
    Views:
    1,712
    Ilias Lazaridis
    Dec 27, 2004
  2. Replies:
    0
    Views:
    3,685
  3. jstorta
    Replies:
    1
    Views:
    11,727
  4. Eleanna Skouta
    Replies:
    2
    Views:
    8,399
    Arne Vajhøj
    Dec 9, 2008
  5. Amit Jain
    Replies:
    7
    Views:
    3,273
    Amit Jain
    Apr 27, 2009
Loading...

Share This Page