Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1731

<include> element only seems to be substituting variables which are on scope "system"





      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}"/>

      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}"/> 

      Now the file will be included. Using any other scope then "system" will result into an "_IS_UNDEFINED" file inclusion.


      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.




            ceki Ceki Gülcü
            terryvdgriend Terry van der Griend
            0 Vote for this issue
            1 Start watching this issue