Announcement Announcement Module
No announcement yet.
Logging and Integration Tests Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

    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
    You should be able to change the log level to DEBUG with the following command:

    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:

    <property name="show_sql">true</property>
    That will give you a clearer picture.


    • #3
      I'm not sure what I'm missing since I executed:

      logging setup --level DEBUG

      which created and I added to it:

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

      I managed to log sql's while running JUnit tests by manually adding the file to the STS Run configuration.
      Now, I verified that 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 for me, but seems to not be the case.