Read environment variables from logback configuration file

前端 未结 6 1908
别那么骄傲
别那么骄傲 2020-12-12 23:29

I have this logback.xml file:



  

        
6条回答
  •  星月不相逢
    2020-12-12 23:58

    Contrary to what the others have said, the logback documentation explicitly states that "During substitution, properties are looked up in the local scope first, in the context scope second, in the system properties scope third, and in the OS environment fourth and last". So if the property is defined in the environment, logback will find it.

    I was having the same issue when running my project in Eclipse. If that's the issue you're having, it can be fixed by going to Run Configurations -> Environment and adding MY_HOME to the environment variables.

    Not really sure why it isn't loading the native environment by default. There's even an option called "Append environment to native environment" which doesn't seem to have any effect for me.

提交回复
热议问题