在Grails中构建WAR时删除了Log4j jar

时间:2014-05-14 11:35:27

标签: grails tomcat7 grails-plugin

这是我在Config.groovy

中的log4j片段
log4j = {
    appenders {
        console name: 'stdout', layout: pattern(conversionPattern: '%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p %c{2} - %m\n')
        rollingFile name:'file', file:'/home/user/logs/app.log', maxFileSize:'5MB', maxBackupIndex:2
    }

    root {
        info "stdout"
    }

    info file: "grails.app"
}

这是我的BuildConfig.groovy

grails.servlet.version = "2.5" 
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.target.level = 1.6
grails.project.source.level = 1.6

grails.project.dependency.resolution = {
    inherits("global") {
        excludes 'serializer'
    }

    log "warn" 
    checksums true 

    repositories {
        inherits true 

        grailsPlugins()
        grailsHome()
        grailsCentral()
    }
    dependencies {
        runtime 'mysql:mysql-connector-java:5.1.20'
        compile "commons-httpclient:commons-httpclient:3.1"
        compile "it.svario.xpathapi:xpathapi-jaxp:0.3"

        build 'org.apache.httpcomponents:httpcore:4.3'
        build 'org.apache.httpcomponents:httpclient:4.3.1'
        build 'org.apache.commons:commons-lang3:3.1'
        runtime 'org.apache.httpcomponents:httpcore:4.3'
        runtime 'org.apache.httpcomponents:httpclient:4.3.1'
        runtime 'org.apache.commons:commons-lang3:3.1'
   }

    plugins {
        runtime ":hibernate:$grailsVersion"
        runtime ":jquery:1.7.2"
        runtime ":resources:1.1.6"
        compile ":rest:0.8"

        build ":tomcat:$grailsVersion"

        compile ':cache:1.0.0'
        compile ":spring-events:1.2"
    }
}

grails.plugin.location.'module' = "../module"

使用的grails版本是2.2.4。当grails run-app时,它运行正常。构建war时,WAR中不包含log4j库。

如果我们手动添加库,则会禁止该异常。但是,日志不会写入app.log。

有人可以为此提供解决方案吗?

更新:此应用程序中使用了Quartz 1.0-RC9插件。这有可能与log4j冲突吗?

0 个答案:

没有答案