Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caused by: org.apache.logging.log4j.LoggingException: log4j-slf4j-impl cannot be present with log4j-to-slf4j #2755

Closed
mklueh opened this issue Aug 19, 2022 · 2 comments
Milestone

Comments

@mklueh
Copy link

mklueh commented Aug 19, 2022

I cannot use hawtio with the latest version in our application. It clashes with Spring Dependencies

These are our dependencies:


//springVersion=2.7.2
//springCloudVersion=2021.0.3

dependencies {
        implementation "org.springframework.boot:spring-boot-starter"

        implementation "org.springframework.boot:spring-boot-starter-web"
        implementation "org.springframework.boot:spring-boot-starter-aop"
        implementation "org.springframework.boot:spring-boot-starter-jdbc"
        implementation "org.springframework.boot:spring-boot-starter-cache"
        implementation "org.springframework.boot:spring-boot-starter-log4j2"
        implementation 'org.springframework.boot:spring-boot-starter-actuator'
        implementation "org.springframework.boot:spring-boot-starter-data-jpa"
        implementation "org.springframework.boot:spring-boot-starter-data-rest"

        implementation 'org.springframework.cloud:spring-cloud-starter'
        implementation "org.springframework.cloud:spring-cloud-starter-bootstrap"
        implementation "org.springframework.cloud:spring-cloud-starter-openfeign"

        implementation 'org.springdoc:springdoc-openapi-ui:1.6.9'
        implementation 'io.hawt:hawtio-springboot:2.15.0'
}

configurations {
    all {
        //noinspection GroovyAssignabilityCheck
        exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
    }
}

And this is the full stacktrace:

SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: org.apache.logging.log4j.LoggingException: log4j-slf4j-impl cannot be present with log4j-to-slf4j
	at org.apache.logging.slf4j.Log4jLoggerFactory.validateContext(Log4jLoggerFactory.java:60)
	at org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:44)
	at org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:33)
	at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:53)
	at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:33)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:363)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
	at com.mainfirst.pmx.client.Application.<clinit>(Application.java:16)

I'm not that much into the logging chaos of Java and not sure what is mandatory and what can go. Preferably I'd like to keep my application the way it was and use hawtio without the transitive dependency that comes with it.
Would it be possible to make it somehow optional?

@tadayosi
Copy link
Member

Relates #2751

@tadayosi
Copy link
Member

tadayosi commented Sep 2, 2022

Fixed #2758

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants