0

I am using Grails 2.1 bundled with the SpringSource's Groovy/Grails Tool Suite 3.0 and have been unsuccessful in getting log messages to display in the console window. I have set the following in the config.groovy
log4j = {
info 'grails.app.controller'
}

However when I use the following line in a controller it does not display in the console

log.info " Hello World!"

Any comments are tips would be welcome. Thanks

jetpilot
  • 47
  • 6

1 Answers1

1

I believe this is because you haven't invoked the appender for the console.

You can do it like:

log4j = {
    appenders {
        console name: "stdout", threshold: org.apache.log4j.Level.INFO
    }
}

You can also specify custom patterns using the layout setting:

log4j = {
    appenders {
        console name: "stdout",
                layout: pattern(conversionPattern: "%c{2} %m%n")
    }
}

Ref: Grails Logging

Vishal
  • 1,236
  • 1
  • 9
  • 16
  • Hi thanks for the feedback, it appears that my problem was not adding an s to the end of controller. So my declaration should have been: info 'grails.app.controllers' – jetpilot Sep 26 '12 at 11:19
  • Yeah! makes sense.. I was already wondering the situation here. I haven't worked past 2.0 grails release so I thought this could have been a problem. Case closed ;) – Vishal Sep 26 '12 at 11:24