Details
-
Bug
-
Resolution: Fixed
-
Major
-
1.4.6
-
Spring boot application 3.x.x
Description
We are migration from Logback 1.2.11 to 1.4.7 and stumbled upon on an issues regarding the <include file=""> element.
When the <include file=""> element is used in combination with a <variable> as its value, it is not able to include the file when the variable is not on the scope "system".
Logback will keep trying to add the file to the ConfigurationWatchListUtil with the "_IS_UNDEFINED" replacement.
Our case:
We are using logback via spring to load a file, this is done based on the configured file location using a <springProperty>. When investigating further we have noticed that this issue is not unique to the <springProperty> but also includes the <variable> and <property> elements.
Reproduction configuration:
<configuration debug="true"> <variable name="include" value="<other file location>.xml"/> <include file="${include}"/> </configuration>
When using the provided configuration the "include" variable is not substituted in the file element. It tries to substitute it, but it is not able to resolve its value.
However when using the following configuration:
<configuration debug="true"> <variable scope="system" name="include" value="<other file location>.xml"/> <include file="${include}"/> </configuration>
Now the file will be included. Using any other scope then "system" will result into an "_IS_UNDEFINED" file inclusion.
Workaround:
For now we have found a workaround which we are not very keen on to keep using. By offloading the original variable onto a system scoped variable we are able to include the file. This does mean that we are exposing unwanted variable on the system properties which we would rather not.
Offloading a <springProperty> to a <variable> with the system scope also seems to work.
Attachments
Issue Links
- relates to (in)
-
LOGBACK-1732 Log file pollution when using the <include> in a conditional block
- Resolved
-
LOGBACK-1746 insertFromJNDI resolves AFTER include in 1.4.x
- Resolved