Class WorkflowAppender

java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.AppenderBase
org.opentestfactory.services.components.logger.WorkflowAppender
All Implemented Interfaces:
ch.qos.logback.core.Appender, ch.qos.logback.core.spi.ContextAware, ch.qos.logback.core.spi.FilterAttachable, ch.qos.logback.core.spi.LifeCycle

public class WorkflowAppender extends ch.qos.logback.core.AppenderBase
This logback appender publishes workflow-related logs as notifications. In nominal flow, the log call will only queue notifications for publication by a worker thread to avoid slowing application threads. If the worker thread cannot keep up, once the queue size limit is reached the appender will fall back to publishing from application threads (but first publishing the head of the queue to keep log order within workflows as much as possible).
Author:
edegenetais
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected LinkedBlockingQueue<org.opentestfactory.dto.v1.WorkflowLogNotification>
     
    protected Thread
     

    Fields inherited from class ch.qos.logback.core.AppenderBase

    name, started

    Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase

    context
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
    org.opentestfactory.dto.v1.WorkflowLogNotification
     
    void
    Use this optional field to tune queue size.
    void
     
    void
     

    Methods inherited from class ch.qos.logback.core.AppenderBase

    addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toString

    Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase

    addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface ch.qos.logback.core.spi.ContextAware

    addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
  • Field Details

    • loggingQueue

      protected LinkedBlockingQueue<org.opentestfactory.dto.v1.WorkflowLogNotification> loggingQueue
    • publicationWorker

      protected Thread publicationWorker
  • Constructor Details

    • WorkflowAppender

      @Inject public WorkflowAppender(BusApiClient busApiClient)
  • Method Details

    • setQueueSize

      public void setQueueSize(Integer size)
      Use this optional field to tune queue size. If it is not used, the appender will default to DEFAULT_QUEUE_SIZE.
      Parameters:
      size -
    • start

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

      public void stop()
      Specified by:
      stop in interface ch.qos.logback.core.spi.LifeCycle
      Overrides:
      stop in class ch.qos.logback.core.AppenderBase
    • append

      protected void append(Object e)
      Specified by:
      append in class ch.qos.logback.core.AppenderBase
    • buildNotification

      public org.opentestfactory.dto.v1.WorkflowLogNotification buildNotification(WorkflowContext ctx, Object e)