tags:

views:

203

answers:

1

I have an issue when i war my grails project to deploy on my production server there is a limitation that i only log to /var/log/tomcat5/catalina.out. This means that i have to make every log including stacktrace write to that one file. I've tried following other examples and it just doesn't seem to work i still get the error "permission denied on stacktrace.log"

This is my log4j config

log4j = {
    // Example of changing the log pattern for the default console
    // appender:
    //
    appender.stacktractLog = "org.apache.log4j.FileAppender"
    appender.'stacktraceLog.File'="/var/log/tomcat5/catalina.out"
    appenders {
        rollingFile name:'catalinaOut', maxFileSize:1024, fileName:"/var/log/tomcat5/catalina.out"
    }

    root {
        error 'catalinaOut'
        additivity = true
    }


    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'

    warn   'org.mortbay.log'
}
A: 

Just modify your configuration:

log4j = {
    // Example of changing the log pattern for the default console
    // appender:
    //
    appenders {
        rollingFile name:'catalinaOut', maxFileSize:1024, fileName:"/var/log/tomcat5/catalina.out"
file name: 'stacktrace', file: "/var/log/tomcat5/catalina.out", layout: pattern(conversionPattern: '%c{2} %m%n')
    }

    root {
        error 'catalinaOut'
        additivity = true
    }

   error stacktrace: "StackTrace"

    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'

    warn   'org.mortbay.log'
}
Olexandr