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

_______________________________________________
logback-dev mailing list
logback-dev@qos.ch
http://qos.ch/mailman/listinfo/logback-dev

Reply via email to