Friday, July 18, 2008

Grails with Jboss and log4j

This is my solution for the Grails and Jboss/log4j issue. I found my jboss deployment of my grails war would freeze when it got up to the log4j section of the deployment. The issue is documented elsewhere, but I didn't like the solutions I found. This solution is to remove the log4j files from the generated war.

Add the following lines to the bottom of grails-app/conf/Config.groovy

grails.war.resources = {stagingDir ->
def toRemove = ["$stagingDir/WEB-INF/lib/log4j-1.2.15.jar", "$stagingDir/WEB-INF/classes/log4j.properties"]
.each {

delete(file: it)
}
}

The idea and code for this came from this post http://ryantownshend.ca/article/show/2
Thanks Ryan

1 comment:

Unknown said...

Very helpful! I fleshed out your suggestion into a full blown tutorial if you or anyone else is interested. Available
here