1 spring boot修改log4j2版本

最近安全问题需要升级log4j2版本,统一替换方式如下:

configurations {
    all {
        compile.exclude module: "spring-boot-starter-logging"
        //compile.exclude module: "spring-boot-starter-tomcat"

        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            if (details.requested.group == 'org.apache.logging.log4j') {
                details.useVersion '2.17.1'
            }
        }
    }
}

如何将默认方式方式换成log4j2的这里也简单记录下

上文所述configurations中添加排除默认日志的依赖:
 compile.exclude module: “spring-boot-starter-logging”
 然后添加了如下依赖
 compile(‘org.springframework.boot:spring-boot-starter-log4j2’)