maaz
maaz

Reputation: 3664

Print Mysql queries produced by Grails

i want to get hold of Mysql queries produced by grails before or after executing.

 trainingList = PrivateTraining.findAll(query,parameter)

i want to print the complete mysql query which is executed by the above statement. is there anyway to print ?

Upvotes: 3

Views: 2407

Answers (2)

Raphael
Raphael

Reputation: 1800

Set this property in your DataSource.groovy:

hibernate.show_sql=true

Example:

environments {
    development {
        dataSource {
            /* ---------------------- */
            hibernate.show_sql = true
            /* ---------------------- */
            dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
            url = "jdbc:mysql://localhost:3306/my-db"
            // ...

Upvotes: 8

eugene82
eugene82

Reputation: 8842

Add the following to your logging configuration:

debug 'org.hibernate'

Upvotes: 1

Related Questions