Grails is all about convention-over-configuration, and in most cases that idea works just fine. Sometime that idea isn’t so great.

The Grails App engine plugin provides an example of this. When packaging and deploying a new version of your app, the grails appengine task generates the appengine-web.xml file for you automatically. This file is used by Google App Engine to configure your app. The problem I faced recently is that I needed to make a change to this file, and there was no way to do it without modifying the GANT task that generates the file. Which is what I did.

In my case I wanted to enable the handy logging mechanism provided by Google AppEngine. GAE uses the java.util.logging framework to accomplish this as documented here.

I copied the file to: MY_GRAILS_APP/web-app/WEB-INF

Then to point to my file, I had to modify the GANT task that generates the appengine-web.xml file.


I modified the section that stamps out the appengine-web.xml file to look like this:

println "Generating appengine-web.xml file for application [$appName]"	
	new File("$stagingDir/WEB-INF/appengine-web.xml").write """<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="">
	    <!-- this property should be necessary. it avoids the report of an abnormal and unexpected situation!
	        <property name="appengine.orm.disable.duplicate.emf.exception" value="true" />
	     <property name="java.util.logging.config.file" value="WEB-INF/"/>

After running a grails app-engine deploy, the new version of the app was deployed and the log messages came through in my Google App Engine Dashboard.

Perhaps in future releases of the grails app engine plugin, a better way will be provided to make changes to the appengine-web.xml file.