在spring boot web应用中调试log4j配置[英] Debug log4j Configuration in a spring boot webapplication

本文是小编为大家收集整理的关于在spring boot web应用中调试log4j配置的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我正在开发带有Spring Boot的多模块WebApp.我的WebApplication始终从依赖端子模块中获取Log4J配置,这是不需要的.有没有办法显示调试信息,使用了哪个logback或log4j文件?

推荐答案

您需要通过将其添加到POM

来排除默认值
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-log4j</artifactId>
</dependency>

本文地址:https://www.itbaoku.cn/post/1575128.html

问题描述

I am developing a multimodule webapp with spring boot. My webapplication always takes the log4j config from the dependend submodule, which is not desired. Is there a way to show debug info, which logback or log4j file is used?

推荐答案

You need to exclude default by adding these to pom

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-log4j</artifactId>
</dependency>