Grails: send debug logging to standard out
When I run my Grails app from my IDE, I want t开发者_Python百科he output to go to the IDE console and be at level Trace.
In grails-app/conf/Config.groovy I've tried a few different things that didn't work, like this:
environments {
development {
log4j.rootLogger="trace,stdout"
}
}
What am I doing wrong?
I think you can try it like this:
log4j = {
appenders {
console name: "stdout", layout: pattern(conversionPattern: "%c{2} %m%n")
// This if you need different settings per environment
environments {
production {
rollingFile name: "myAppender", maxFileSize: 1024, file: "/tmp/logs/myApp.log"
}
}
}
root {
trace "stdout"
}
// we are saying default is trace for the console,
// but for this package we are setting default as debug
debug "grails.app.controller"
environments {
production {
// Override previous setting for 'grails.app.controller'
error "grails.app.controller"
}
}
}
More examples can be found in the Grails docs for Logging.
Hope this helps!
精彩评论