Grails debug logging

There are two things about logging in Grails which can be a little pain. The first one is to activate debug logging in some domain or controller class during testing. To make this work, use the following with each class under testing:

mockLogging Foo, true

Now, all the debug messages in you class Foo will be generated.

The other thing which can be a pain, is enabling debug in general, and Hibernate debugging in particular. Well, not this time, since you have to only add the following to your Config.groovy file:

log4j= {
    ...
    debug 'com.foo.app',
          'org.hibernate'
}

Yes, Grails is that easy!

No hay comentarios:

Publicar un comentario