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

Adding -Dlogback.ContextSelector=JNDI does not work for detecting the custom logger context name #781

Open
gmiscione opened this issue Feb 8, 2024 · 2 comments

Comments

@gmiscione
Copy link

gmiscione commented Feb 8, 2024

We are deploying our application with tomcat and we are specifing the custom context name in our web.xml like this:

<!-- name for logback lookup -->
<env-entry>
  <env-entry-name>logback/context-name</env-entry-name>
  <env-entry-type>java.lang.String</env-entry-type>
  <env-entry-value>contextA</env-entry-value>
</env-entry>

With logback 1.2.9, when tomcat is launched with the -Dlogback.ContextSelector=JNDI, the application correctly loads the file logback-contextA.xml and inits the logger with its content. In version 1.3.14, the JNDI lookup is not done. Investigating the issue, we found out that now the code is relying on java services to detect the binding and it's using ch.qos.logback.classic.spi.LogbackServiceProvider to init the logger, but in this class the call to contextSelectorBinder.init(defaultLoggerContext, KEY); is commented, so the context selector binder is not called at all. It seems that the comment has been added in this commit.

Are we missing something there or is it a bug in the service provider not calling the context selector init method?

@gmiscione
Copy link
Author

I just saw that there is another identical issue #765

@lvjing2
Copy link

lvjing2 commented Feb 29, 2024

We are working on same task like deploy apps into one jvm, would you like to try kouoleless, we can build a modular framework for java eachsystem. how do you think?

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