
<configuration>

  <if condition='property("HOSTNAME").equals("XYZ87")'>
    <then>

      <appender name="CON" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
          <pattern>%d %-5level %logger{35} - %msg %n</pattern>
        </encoder>
      </appender>
      <root>
        <appender-ref ref="CON" />
      </root>

    </then>
    <else>

      <appender name="LIST" class="ch.qos.logback.core.read.ListAppender"/>
      <root>
        <appender-ref ref="LIST" />
      </root>

    </else>
  </if>

  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
    <file>${randomOutputDir}/conditional.log</file>
    <encoder>
      <pattern>%d %-5level %logger{35} - %msg %n</pattern>
   </encoder>
  </appender>

  <root level="ERROR">
     <appender-ref ref="FILE" />
  </root>




</configuration>