Class LoggingGroupDiscriminator

java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.sift.AbstractDiscriminator<ch.qos.logback.classic.spi.ILoggingEvent>
com.aspectran.logging.LoggingGroupDiscriminator
All Implemented Interfaces:
ch.qos.logback.core.sift.Discriminator<ch.qos.logback.classic.spi.ILoggingEvent>, ch.qos.logback.core.spi.ContextAware, ch.qos.logback.core.spi.LifeCycle

public class LoggingGroupDiscriminator extends ch.qos.logback.core.sift.AbstractDiscriminator<ch.qos.logback.classic.spi.ILoggingEvent>
Discriminates logging events based on the name given to the ActivityContext of the current CoreService.

ex)


   <appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">
     <discriminator class="com.aspectran.core.support.logging.LoggingGroupDiscriminator">
       <key>LOGGING_GROUP</key>
       <defaultValue>app</defaultValue>
     </discriminator>
     <sift>
       <appender name="FILE-${LOGGING_GROUP}" class="ch.qos.logback.core.rolling.RollingFileAppender">
         <file>${aspectran.basePath:-app}/logs/${LOGGING_GROUP}.log</file>
         ...
       </appender>
     </sift>
   </appender>
 

See Also:
  • Field Summary

    Fields inherited from class ch.qos.logback.core.sift.AbstractDiscriminator

    started

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

    context
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    getDiscriminatingValue(ch.qos.logback.classic.spi.ILoggingEvent event)
    Returns the name of the current CoreService's ActivityContext.
     
    void
    setDefaultValue(String defaultValue)
     
    void
     
    void
     

    Methods inherited from class ch.qos.logback.core.sift.AbstractDiscriminator

    isStarted, stop

    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, toString, wait, wait, wait
  • Constructor Details

    • LoggingGroupDiscriminator

      public LoggingGroupDiscriminator()
  • Method Details

    • getDiscriminatingValue

      public String getDiscriminatingValue(@NonNull ch.qos.logback.classic.spi.ILoggingEvent event)
      Returns the name of the current CoreService's ActivityContext. If that value is null, then return the value assigned to the defaultValue property.
    • getKey

      public String getKey()
    • setKey

      public void setKey(String key)
    • getDefaultValue

      public String getDefaultValue()
    • setDefaultValue

      public void setDefaultValue(String defaultValue)
    • start

      public void start()
      Specified by:
      start in interface ch.qos.logback.core.spi.LifeCycle
      Overrides:
      start in class ch.qos.logback.core.sift.AbstractDiscriminator<ch.qos.logback.classic.spi.ILoggingEvent>