[logback-dev] if-then-else support in Joran.
Ceki Gülcü
ceki at qos.ch
Mon Mar 29 21:50:48 CEST 2010
Hello all,
I began implementing if-then-else support in Joran. If you wish to
enable part of a config file in one environment and disable it
another, now you can.
Here is an example,
<configuration>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<encoder>
<pattern>%d %-5level %logger{35} - %msg %n</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="FILE" />
</root>
<if condition='property("HOSTNAME").contains("mydevHost")'>
<then>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %-5level %logger{35} - %msg %n</pattern>
</encoder>
</appender>
<root incremental="true">
<appender-ref ref="STDOUT" />
</root>
</then>
</if>
</configuration>
Thus, the ConsoleAppender will be attached to the root logger only on
"mydevHost" but not on other hosts.
This feature is still experimental. Your feedback is welcome.
--
Ceki
More information about the logback-dev
mailing list