Skip to content

Instantly share code, notes, and snippets.

@tlarevo
Last active August 29, 2015 14:21
Show Gist options
  • Save tlarevo/b4407e0ecf8d5ef100b8 to your computer and use it in GitHub Desktop.
Save tlarevo/b4407e0ecf8d5ef100b8 to your computer and use it in GitHub Desktop.
log4j.main = {
// Example of changing the log pattern for the default console appender:
//
def layout = new PatternLayout("%d [%t] %-5p %c{1} %x - %m%n")
def logName = { String baseName -> "logs/${appName}-${baseName}.log" }
appenders {
console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n')
appender new DailyRollingFileAppender(
name: 'infoLog',
threshold: Level.INFO,
datePattern: "'.'yyyy-MM-dd", // See the API for all patterns.
fileName: logName('info'),
layout: layout
)
appender new DailyRollingFileAppender(
name: 'debugLog',
threshold: Level.DEBUG,
datePattern: "'.'yyyy-MM-dd", // See the API for all patterns.
fileName: logName('debug'),
layout: layout
)
appender new DailyRollingFileAppender(
name: 'errorLog',
threshold: Level.ERROR,
datePattern: "'.'yyyy-MM-dd", // See the API for all patterns.
fileName: logName('error'),
layout: layout
)
}
root {
error 'errorLog'
info 'infoLog'
debug 'debugLog'
}
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',
'org.apache'
debug 'com.grails.cxf.client'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment