Results 1 to 3 of 3

Thread: Logging and Integration Tests

  1. #1
    Join Date
    Feb 2010
    Posts
    23

    Default Logging and Integration Tests

    I have setup a simple Roo project, created my Entities,added logging support and generated integration tests, all using Roo's commands.
    I'm running the tests with 'perform tests' and all of them fail with a:

    org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.GenericJDBCException: could not execute query; nested exception is
    javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute query
    exception.


    Now I'd like to check what query hibernate is trying to execute, but seems like log4j is not kicking in when I run the tests - the log file isn't created at all.

    Any idea how to get logging working with the integration tests? Should it be 'automagic' or am I missing something?

  2. #2
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    You should be able to change the log level to DEBUG with the following command:

    Code:
    logging setup --level DEBUG --package PERSISTENCE
    If you look up the Hibernate docs you'll also find you can get Hibernate to display all executed SQL statements by adding this to the persistence.xml:

    Code:
    <property name="show_sql">true</property>
    That will give you a clearer picture.
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

  3. #3
    Join Date
    Feb 2010
    Posts
    23

    Default

    I'm not sure what I'm missing since I executed:

    logging setup --level DEBUG

    which created log4j.properties and I added to it:

    log4j.logger.org.hibernate.SQL=DEBUG

    which gives me the SQL's according to hibernate documentation.

    I managed to log sql's while running JUnit tests by manually adding the log4j.properties file to the STS Run configuration.
    Now, I verified that log4j.properties file is not included in the deployment of my app in tcServer v6.0 and I cannot see any of the logs while running the deployed app.

    I assumed STS/Roo would package and deploy log4j.properties for me, but seems to not be the case.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •