Grails App not deploying on tomcat your server? Here’s the fix.

If you are trying to deploy a grails app on tomcat using a war and for some reason the war isn’t deploying then your app may be trying to create log files that it does not have permission to create or write too.

Just add the following to your grails-app/Config.groovy file and you should be good to go

def catalinaBase = System.properties.getProperty(‘catalina.base’)
if (!catalinaBase) catalinaBase = ’.’   // just in case
def logDirectory = “${catalinaBase}/logs”

log4j

= { root ->
    appenders
{
        rollingFile name
:‘stdout’, file:“${logDirectory}/${appName}.log”.toString(),  maxFileSize:‘100MB’
        rollingFile name
:‘stacktrace’, file:“${logDirectory}/${appName}_stack.log”.toString(), maxFileSize:‘100MB’
     
}

     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’
     root
.level = org.apache.log4j.Level.WARN
 
}

Special thanks to lazygun for his article on setting up rackspace cloud for grails. http://www.lazygun.net/deploying-a-grails-app-to-rackspace-cloud-ser