2 years ago

#64030

test-img

Illidan

Log loss of a java.util.logging dependency

I have a dependency that logs in as follows :

import java.util.logging.Logger;

private final Logger logger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);

And an application that uses the dependency with the following pom :

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.10</version>
    </parent>

    <properties>
        <log4j2.version>2.17.0</log4j2.version>
    </properties>

and the following implementation

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

private static final Logger logger = LogManager.getLogger(Example.class);

and with this configuration it only logs the main application, but if I add this to the pom ....

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.16</version>
        </dependency>

What should I change in the code of the first dependency if I can't use spring to make this work without using log4j 1.2.16 ? What other solutions do I have?

java

spring

log4j

log4j2

java.util.logging

0 Answers

Your Answer

Accepted video resources