Grails logging

Short tips on showing Grails debug log messages.

This post has moved to:
http://haxx.sinequanon.net/2008/09/grails-logging/

To turn on display of debug log messages in Grails 1.0.2, add this to the bottom of grails-app/conf/Config.groovy:

environments {
  development {
    log4j {
      logger {
         grails."app"="debug,stdout"
      }
    }
  }
}

With Grails 1.0.3 the above will produce an error message like No such property: context for class: java.lang.String

For 1.0.3, use this:

environments {
  development {
    log4j {
      logger {
        grails {
          app="debug"
        }
      }
    }
  }
}

In your code, simply use log.debug("my message")

Thanks to the grails-user mailing list for a clue towards this.

Leave a Reply