facebook

How do I initialize the log4j system properly for hibernate?

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #247103 Reply

    johnjoreilly
    Member

    In the quickstart it says we can ignore this message, but I’d like to actually use log4j here.

    log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
    log4j:WARN Please initialize the log4j system properly.

    I downloaded a log4j.properities example from hibernate.org (couldn’t find it in the hibernate3.jar) and put it in the /lib directory.

    Still getting the same warning.

    Version: 4.1.0 GA
    Build id: 20060122-4.1-GA

    ### 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

    ### 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=info
    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

    #247128 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev

    Put it in the top of your /src directory so it gets built out to your /classes directory, log4j should find and use it then.

    #247192 Reply

    johnjoreilly
    Member

    The error is when I am running a test as described in the hibernate quickstart tutorial. I do not see an error when accessing the hibernate layer from my EJB. If that matters…

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: How do I initialize the log4j system properly for hibernate?

You must be logged in to post in the forum log in