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

Consider remove LettuceCdiExtension.LOGGER or defer creating it #1351

Closed
quaff opened this issue Jul 20, 2020 · 3 comments
Closed

Consider remove LettuceCdiExtension.LOGGER or defer creating it #1351

quaff opened this issue Jul 20, 2020 · 3 comments
Labels
status: declined A suggestion or change that we dont feel we should currently apply

Comments

@quaff
Copy link

quaff commented Jul 20, 2020

Open Liberty will create LettuceCdiExtension instance before application initialization, it cause underlying logging like log4j2 initialize too early.
see also spring-projects/spring-framework#25427

@quaff quaff added the type: bug A general bug label Jul 20, 2020
@mp911de
Copy link
Collaborator

mp911de commented Jul 20, 2020

So how are we supposed to log the initialization in the constructor:

https://github.com/lettuce-io/lettuce-core/blob/b978238db8a33c8860819b73e528f016f940e992/src/main/java/io/lettuce/core/support/LettuceCdiExtension.java#L88

Or is it just that the logger is static?

@mp911de mp911de added status: waiting-for-feedback We need additional information before we can continue type: enhancement A general enhancement and removed type: bug A general bug labels Jul 20, 2020
@quaff
Copy link
Author

quaff commented Jul 21, 2020

I'm afraid that removing static like StandardWebSocketHandlerAdapter is not enough, jboss weld will new instance of LettuceCdiExtension not only load it.
here is stack trace:

[err] 	at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
[err] 	at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:138)
[err] 	at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:45)
[err] 	at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:48)
[err] 	at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:30)
[err] 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
[err] 	at io.netty.util.internal.logging.Slf4JLoggerFactory.newInstance(Slf4JLoggerFactory.java:49)
[err] 	at io.netty.util.internal.logging.InternalLoggerFactory.newDefaultFactory(InternalLoggerFactory.java:43)
[err] 	at io.netty.util.internal.logging.InternalLoggerFactory.getDefaultFactory(InternalLoggerFactory.java:67)
[err] 	at io.netty.util.internal.logging.InternalLoggerFactory.getInstance(InternalLoggerFactory.java:93)
[err] 	at io.netty.util.internal.logging.InternalLoggerFactory.getInstance(InternalLoggerFactory.java:86)
[err] 	at io.lettuce.core.support.LettuceCdiExtension.<clinit>(LettuceCdiExtension.java:79)
[err] 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[err] 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[err] 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[err] 	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
[err] 	at org.jboss.weld.util.ServiceLoader.createInstance(ServiceLoader.java:313)
[err] 	at [internal classes]
[err] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[err] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[err] 	at java.lang.Thread.run(Thread.java:748)

@mp911de mp911de added status: declined A suggestion or change that we dont feel we should currently apply and removed status: waiting-for-feedback We need additional information before we can continue type: enhancement A general enhancement labels Jul 21, 2020
@mp911de
Copy link
Collaborator

mp911de commented Jul 21, 2020

We'd like to keep the logging feature to indicate the extension was activated as in the past it was difficult to diagnose which CDI extensions got activated. That being said, there's nothing we can do here.

@mp911de mp911de closed this as completed Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we dont feel we should currently apply
Projects
None yet
Development

No branches or pull requests

2 participants