SpringBoot学习与总结

gradle + SpringBoot + Log4j 配置

2016-08-30  本文已影响227人  花绽放水流年

本文中所述SpringBoot基于1.4.0.RELEASE版本

基本方法就是将compile范围依赖的spring-boot-starter-logging排除,然后依赖spring-boot-starter-log4j即可

build.gradle中配置如下

configurations {    
    compile.exclude module: 'spring-boot-starter-logging'//排除对默认logging的依赖
}

dependencies {    
    testCompile group: 'junit', name: 'junit', version: '4.12' 
    compile("org.springframework.boot:spring-boot-starter-web:1.4.0.RELEASE")  
    //添加对log4j starter的依赖。
    compile("org.springframework.boot:spring-boot-starter-log4j:1.3.7.RELEASE") 
}

或者

dependencies {    
    testCompile group: 'junit', name: 'junit', version: '4.12' 
    compile("org.springframework.boot:spring-boot-starter-web:1.4.0.RELEASE")   {
        exclude module:'spring-boot-starter-logging'
    }
    //添加对log4j starter的依赖。
    compile("org.springframework.boot:spring-boot-starter-log4j:1.3.7.RELEASE") 
}
上一篇 下一篇

猜你喜欢

热点阅读