3
votes

Grails 2.4.4 and Tomcat 8.0.20

log4j = {
appenders {
    rollingFile name:'w_file', file:"D:\\Program Files\\Apache Software Foundation\\Tomcat 8.0\\logs\\app.jog".toString(), maxFileSize:'10MB'
}

root {
    debug 'stdout', 'w_file'
}

debug  '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'

}

I've tried a lot of variants of configure. It's latest. I make war by command line: grails war and I see the file 'app.jog' in directory 'D:\Program Files\Apache Software Foundation\Tomcat 8.0\logs' with logging of building. But after deploying this war into tomcat the log doesn't update/create, although the application works properly.

1
I can't understand it works fine on Jetty8, but doesn't work on Tomcat8 - SergSW
Same problem... I have tried a several configurations and nothing works! Using: Grails 2.5.1 with Tomcat Apache Tomcat/8.0.24 - dmonti
I have the same Problem with grails 2.5.1 and Tomcat 7. Did you find a solution? - woezelmann
No. I just work with Jetty. - SergSW

1 Answers

0
votes

Give your path using System.getProperty('catalina.base').

It works for me on my setup: grails-2.4.3 & tomcat 8.0.3

Log files are generated at: E:\Dev\Tools\tomcat\logs or ([CATALINA_BASE]\logs)

log4j.main = {
appenders {
    file name:'file', file: System.getProperty('catalina.base') + '/logs/analytics.log', layout:pattern(conversionPattern: '%d{HH:mm:ss.SSS} [%t] %-5p %c{5} - %m%n')
}

root {
    info 'file'
}

error  'org.codehaus.groovy.grails.web.servlet',        // controllers
       'org.codehaus.groovy.grails.web.pages',          // GSP
       'org.codehaus.groovy.grails.web.sitemesh',       // layouts
}