In a Spring Boot / Logback project, I want to check if a system property is set to use a given appender or not. My code is:
<property name="MY_PROPERTY" value="${MY_PROPERTY:-}" />
....
<logger name="com.my.project" level="INFO">
<if condition='property("MY_PROPERTY").equalsIgnoreCase("MY_PROPERTY_IS_UNDEFINED")'>
<then>
<appender-ref ref="STDOUT" />
</then>
<else>
<appender-ref ref="APPENDER_WITH_ MY_PROPERTY" />
</else>
</if>
</logger>
The code above (seems to) works, but this is not nice. The property() method append _IS_UNDEFINED to the variable name and I use it...
I can't find any reliable documentation about it, is there a better way?