Reputation: 5345
I want to log all info levels in my app. For this I have added to the predefined:
log4j = {
error 'org.codehaus.groovy.grails.web.servlet', // controllers
'org.codehaus.groovy.grails.web.pages', // GSP
'org.codehaus.groovy.grails.web.sitemesh', // layouts
'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping
'org.codehaus.groovy.grails.web.mapping', // URL mapping
'org.codehaus.groovy.grails.commons', // core / classloading
'org.codehaus.groovy.grails.plugins', // plugins
'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
'org.springframework',
'org.hibernate',
'net.sf.ehcache.hibernate'
info 'grails.app' //this is what I have added.
}
In my class I have defined my logger with:
private static final log = LogFactory.getLog(this)
and I am loggin with log.info("enter register method")
However, I get nothing on the console output.(the class is called!!!) Any recommendations? I appreciate your answer!
Upvotes: 1
Views: 299
Reputation: 1500
info 'grails.app'
sets the info logging level for all classes that are in grails-app folder - like controllers, services, domain classes, taglibs etc.
If you want to set the info level for ALL classes, even third-party dependencies, you should set the root logger to this level:
import org.apache.log4j.Level
...
log4j = {
root ->
// root logger config
root.setLevel(Level.INFO)
}
Upvotes: 2