Created
March 20, 2015 04:03
-
-
Save leewin12/301ec972e5708a166492 to your computer and use it in GitHub Desktop.
Grails 2.4.4 logging with multi environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// log4j configuration | |
log4j = { | |
appenders { | |
console name: 'stdout', encoder: pattern(conversionPattern: "%d{ISO8601} %p %c{2} %m%n") | |
appender new DailyRollingFileAppender( | |
name: 'rollingFileAppender', | |
file: "logs/cola.log", append: true, datePattern: "'.'yyMMdd", | |
layout: pattern(conversionPattern: "%d{ISO8601} %p %c{2} %m%n") | |
) | |
} | |
environments { | |
development { | |
info 'grails.app.controllers.cola', | |
'grails.app.domain.cola', | |
'grails.app.services.cola', | |
'grails.app.taglib.cola', | |
'grails.app.conf.cola', | |
'grails.app.filters.cola' | |
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.orm.hibernate', // hibernate integration | |
'org.codehaus.groovy.grails.plugins', // plugins | |
'org.springframework', | |
'org.hibernate', | |
'net.sf.ehcache.hibernate' | |
// trace 'com.granicus.grails.plugins.cookiesession' | |
} | |
production { | |
root { | |
error 'rollingFileAppender', additivity: false | |
} | |
info rollingFileAppender: [ | |
'grails.app.controllers.cola', | |
'grails.app.domain.cola', | |
'grails.app.services.cola', | |
'grails.app.taglib.cola', | |
'grails.app.conf.cola', | |
'grails.app.filters.cola' | |
], additivity: false | |
error rollingFileAppender: "StackTrace", additivity: false | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment