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

FR: Allow for other slf4j-api implementations #366

Open
john2home opened this issue Oct 21, 2022 · 3 comments
Open

FR: Allow for other slf4j-api implementations #366

john2home opened this issue Oct 21, 2022 · 3 comments
Labels
feature Contributions welcome!

Comments

@john2home
Copy link

Problem or use case

the broker does not allow the use of any other implementation of the slf4j-api. normally an application uses only the slf4j-api and leaves it up to the user to decide which slf4j-api-implementation to use.

but if you exclude logback-classic the embedded broker hangs up in HiveMQServer.bootstrap() by calling LoggingBootstrap.prepareLogging();

Preferred solution or suggestions

the embedded broker should only use the slf4j-api and leave it up to the user to decide which implementation he wants/can/must use.

@pglombardo pglombardo added the feature Contributions welcome! label Nov 15, 2022
@pglombardo
Copy link
Contributor

Hi @john2home - thanks for pointing this issue out. It's a fair request and makes sense.

I filed this in our feature request database. If I hear anything back, I'll make sure to update this issue.

@pglombardo pglombardo changed the title embedded broker forces use of logback-classic FR: Allow for other slf4j-api implementations Nov 15, 2022
@Zomis
Copy link

Zomis commented Apr 6, 2023

I totally agree about this issue. Solving this issue will also solve #319, which I think was inappropriately closed. Using slf4j-api, there's no reason to not support other logging frameworks. Both this issue and #319 has the same solution: Use slf4j-api.

Additionally, I have found that using com.hivemq:hivemq-community-edition-embedded:2023.2 in combination with ch.qos.logback:logback-core:1.1.11 is working, but ch.qos.logback:logback-core:1.4.6 (latest version as of today) is not working. It fails at:

ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:62)

with the error: java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/action/AbstractEventEvaluatorAction

Changing the implementation of ContextInitializer.configureByResource is a good first step to solve these issues.

@kazetsukaimiko
Copy link

I have an issue embedding HiveMQ into a Quarkus app, related to this.

Caused by: java.lang.ClassCastException: class org.slf4j.impl.Slf4jLoggerFactory cannot be cast to class ch.qos.logback.classic.LoggerContext (org.slf4j.impl.Slf4jLoggerFactory is in unnamed module of loader 'app'; ch.qos.logback.classic.LoggerContext is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @55b53d44)
	at com.hivemq.bootstrap.LoggingBootstrap.getRootLogger(LoggingBootstrap.java:145)
	at com.hivemq.bootstrap.LoggingBootstrap.prepareLogging(LoggingBootstrap.java:67)
	at com.hivemq.HiveMQServer.bootstrap(HiveMQServer.java:108)
	at com.hivemq.embedded.internal.EmbeddedHiveMQImpl.stateChange(EmbeddedHiveMQImpl.java:150)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)

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

No branches or pull requests

4 participants