Grails - No Logging In Tomcat

前端 未结 2 917
广开言路
广开言路 2021-02-14 16:06

I cannot get grails log4j logging to work in Tomcat6. I previously thought the problem had to do with Production mode, but now I believe the issue is tomcat.

I have a l

相关标签:
2条回答
  • 2021-02-14 16:30

    It could be the way you define your environment in the DSL config I have similar setup: Grails 1.3.7 + Tomcat 6.0 this works great for me.

    log4j = {
        environments {
            production {
            appenders {
                def catalinaBase = System.properties.getProperty('catalina.base')
                if (!catalinaBase) catalinaBase = '.'
                def logDirectory = "${catalinaBase}/logs"
    
                /* log file appender config & layout */
                appender new DailyRollingFileAppender(
                    name:"logfile",
                    file:"$logDirectory/logfilename.log",
                    layout:pattern(conversionPattern: "%d{yy.MM.dd HH:mm:ss} [%t] %-5p %c %x - %m%n"),
                    datePattern:"'.'yyyy-MM-dd",
                    threshold: org.apache.log4j.Level.ERROR 
            }
    
            /* type of errors to log */
            error  'org.codehaus.groovy.grails.scaffolding.view.ScaffoldingViewResolver', 
                   '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', // class
                   'org.codehaus.groovy.grails.plugins', // plugins
                   'org.codehaus.groovy.grails.orm.hibernate', // hibernate
                   'org.springframework', // spring
                   'org.hibernate', // hibernate
    
    
    
            /* jetty, not required on tomcat */
            warn   'org.mortbay.log'
    
    
            /* root logger config */
            root {
                debug 'logfile'
                additivity = true
            }
        }//production
    
        development{
             /* add config for development evn*/
        }
    
        test{
             /* add config for test env*/
        } 
    
    }//log4j
    
    0 讨论(0)
  • 2021-02-14 16:51

    It had something to do with a bogus web-inf file that resided from a long time ago. This works correctly when that is not there.

    0 讨论(0)
提交回复
热议问题