Announcement Announcement Module
Collapse
No announcement yet.
Logging and Integration Tests Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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
    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
    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.

    Comment


    • #3
      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.

      Comment

      Working...
      X