Skip to content

Instantly share code, notes, and snippets.

@EwanDawson
Created June 5, 2011 16:16
Show Gist options
  • Save EwanDawson/1009112 to your computer and use it in GitHub Desktop.
Save EwanDawson/1009112 to your computer and use it in GitHub Desktop.
Grails BuildConfig for using logback instead of log4j
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
//grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.dependency.resolution = {
inherits("global") {
excludes "slf4j-log4j12"
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
repositories {
grailsPlugins()
grailsHome()
grailsCentral()
mavenLocal()
mavenCentral()
}
dependencies {
// grails 1.3.7 ships with slf4j-api 1.5.8, so the latest version of logback you can use is 0.9.17
build 'ch.qos.logback:logback-core:0.9.17', 'ch.qos.logback:logback-classic:0.9.17'
runtime 'ch.qos.logback:logback-core:0.9.17', 'ch.qos.logback:logback-classic:0.9.17', 'org.slf4j:log4j-over-slf4j:1.5.8'
}
}
// Remove logback-test.xml from the production WAR, so that logback.xml is used instead
grails.war.resources = { stagingDir ->
delete(file:"${stagingDir}/WEB-INF/classes/logback-test.xml")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment