Accessing the application properties in logback.xml

后端 未结 2 1053
误落风尘
误落风尘 2020-12-14 17:00

Is it possible to access application properties of spring boot in log back xml.

application.properties

dummy.property=hello
<         


        
2条回答
  •  一整个雨季
    2020-12-14 17:22

    According to the http://logback.qos.ch/manual/configuration.html#variableSubstitution

    Variables can be defined one at a time in the configuration file itself or loaded wholesale from an external properties file or an external resource.
    ...
    The property is not declared in the configuration file, thus logback will look for it in the System properties.

    Logback can use system properties or properties defined explicitely. So you need to tell logback to use application.properties file

    
    

提交回复
热议问题