Class CombinedMdcDiscriminator

java.lang.Object
com.xebialabs.platform.test.testng.CombinedMdcDiscriminator
All Implemented Interfaces:
ch.qos.logback.core.sift.Discriminator<ch.qos.logback.classic.spi.ILoggingEvent>, ch.qos.logback.core.spi.LifeCycle

public class CombinedMdcDiscriminator extends Object implements ch.qos.logback.core.sift.Discriminator<ch.qos.logback.classic.spi.ILoggingEvent>
Interacts with test setup code that sets a MDC ProvisionedVm to the VM being provisioned. And for TestNG add the MdcTestListener to a test case to set the test name in the MDC. Use as follows:
     <appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">
       <discriminator class="com.xebialabs.probsels.CombinedMdcDiscriminator" />
       <sift>
          <appender name="${logname}" class="ch.qos.logback.core.FileAppender">
               <file>${logname}.log</file>
               <layout class="ch.qos.logback.classic.PatternLayout">
                   <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] {%mdc} %-5level %logger{36} - %msg%n%rootException</pattern>
               </layout>
           </appender>
       </sift>
   </appender>
 
  • Constructor Details

    • CombinedMdcDiscriminator

      public CombinedMdcDiscriminator()
  • Method Details

    • getDiscriminatingValue

      public String getDiscriminatingValue(ch.qos.logback.classic.spi.ILoggingEvent iLoggingEvent)
      Specified by:
      getDiscriminatingValue in interface ch.qos.logback.core.sift.Discriminator<ch.qos.logback.classic.spi.ILoggingEvent>
    • getKey

      public String getKey()
      Specified by:
      getKey in interface ch.qos.logback.core.sift.Discriminator<ch.qos.logback.classic.spi.ILoggingEvent>
    • start

      public void start()
      Specified by:
      start in interface ch.qos.logback.core.spi.LifeCycle
    • stop

      public void stop()
      Specified by:
      stop in interface ch.qos.logback.core.spi.LifeCycle
    • isStarted

      public boolean isStarted()
      Specified by:
      isStarted in interface ch.qos.logback.core.spi.LifeCycle