-
Notifications
You must be signed in to change notification settings - Fork 40.9k
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
<springProperty> and <springProfile> do not work in <include> after Logback upgrade #40491
Comments
The bug affects 3.3.0-RC1 that uses logback 1.5.6 (see #40401). Spring boot 3.2.5 uses version 1.4.14 of logback, the issue arises when manually upgrade to logback >= 1.5.5. |
Hey, thanks for the report. Can you please attach your sample project as something we can clone or unzip? Thanks! |
Thanks for the sample @fupgang. The Spring Boot documentation states that a file Spring Boot adds the Lines 103 to 108 in d534204
Logback's When using Logback 1.5.4 and earlier, When using Logback 1.5.5 and later, Spring Boot might be able to address this by adding @ceki Was this change in lookup paths intended as part of the changes mentioned above in Logback 1.5.5 and 1.5.6? |
@scottfrederick I think the analysis provided by @fupgang is quite accurate. The key phrase is:
The fix suggested by @fupgang seems quite appropriate. Indeed, the default configurator supplier will return an instance of As for the In short, overriding Perhaps something like:
|
Logback refactored the inclusion of configuration snippets in version 1.5.5. (For details see this commit and this comment in logback repo.)
Updating logback from <= 1.5.4 to >= 1.5.5 breaks
<springProperty>
when used within an included configuration snippet.Example
A simple spring boot application using logback.
A prefix for log messages is configured in the environment using
<springProperty>
.logback.xml
included.xml
in application.properties
The expected log output is "[prefix from env] ..." but acutaly is "prefix_IS_UNDEFINED ...".
Cause
Since the refactoring a new instance of
JoranConfigurator
is created when an inclusion is processed.new code in
JoranConfigurator
The new instance is currently not a
SpringBootJoranConfigurator
but a simpleJoranConfigurator
that does not know about springs extensions (e.g.<springProperty>
).Therefore
<springProfile>
might be affected as well.Fix
Overriding
buildModelInterpretationContext()
inSpringBootJoranConfigurator
to provide an instance ofSpringBootJoranConfigurator
with the sameLoggingInitializationContext
.The text was updated successfully, but these errors were encountered: