美文网首页SpringBoot学习与总结
gradle + SpringBoot + Log4j 配置

gradle + SpringBoot + Log4j 配置

作者: 花绽放水流年 | 来源:发表于2016-08-30 15:05 被阅读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") 
    }
    

    相关文章

      网友评论

        本文标题:gradle + SpringBoot + Log4j 配置

        本文链接:https://www.haomeiwen.com/subject/nynfettx.html