However, as of version 0.9.20 (to be released early April), logback supports conditional configuration statements. Thus, we can write:
<appender name="FILE" class="ch.qos.logback.core.FileAppender">Thus, if the "catalina.home" system property is defined (non null), then the log file will be written to ${catalina.home}/logs/myApp.log, otherwise, we are in the development environment and the logs should be written to ./logs/myApp.log.
<if condition='!isNull("catalina.home")'>
<then>
<File>${catalina.home}/logs/myApp.log</File>
</then>
<else>
<File>./logs/myApp.log</File>
</else>
</if>
...
</appender>
In this particular case, the if-then-else approach is more verbose than default variable substitution, i.e. simply writing
${catalina.home:-.}
. However, it goes without saying that conditional configuration brings much needed flexibility to the table. Keep in mind that given the verbosity of XML, one could gradually end up with a configuration file containing many logical branches rendering the file ungrokable. In case you ask, nested if-then-else statements are supported. So please use conditionals with moderation so that complexity does not creep into your configuration files.