Class IbisMaskingLayout

java.lang.Object
org.apache.logging.log4j.core.layout.AbstractLayout<String>
org.apache.logging.log4j.core.layout.AbstractStringLayout
org.frankframework.logging.IbisMaskingLayout
All Implemented Interfaces:
org.apache.logging.log4j.core.impl.LocationAware, org.apache.logging.log4j.core.Layout<String>, org.apache.logging.log4j.core.layout.Encoder<org.apache.logging.log4j.core.LogEvent>, org.apache.logging.log4j.core.StringLayout
Direct Known Subclasses:
IbisPatternLayout

public abstract class IbisMaskingLayout extends org.apache.logging.log4j.core.layout.AbstractStringLayout
This is a wrapper for Log4j2 layouts. It enables us to:
- limit log message length
- apply global masking
- apply local (thread-wise) masking
Author:
Murat Kaan Meral
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout

    org.apache.logging.log4j.core.layout.AbstractStringLayout.Builder<B extends org.apache.logging.log4j.core.layout.AbstractStringLayout.Builder<B>>, org.apache.logging.log4j.core.layout.AbstractStringLayout.Serializer, org.apache.logging.log4j.core.layout.AbstractStringLayout.Serializer2
  • Field Summary

    Fields inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout

    DEFAULT_STRING_BUILDER_SIZE, MAX_STRING_BUILDER_SIZE

    Fields inherited from class org.apache.logging.log4j.core.layout.AbstractLayout

    configuration, eventCount, footer, header, LOGGER

    Fields inherited from interface org.apache.logging.log4j.core.Layout

    ELEMENT_TYPE
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    IbisMaskingLayout(org.apache.logging.log4j.core.config.Configuration config, Charset charset)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
     
    static void
    Add regex to hide locally, meaning for specific threads/adapters.
    static void
     
    static void
     
    static Set<String>
     
    static int
     
    static String
     
    static Set<String>
    Set of regex strings to hide locally, meaning for specific threads/adapters.
    static void
     
    static void
    Remove regex to hide locally, meaning for specific threads/adapters.
    static void
     
    protected abstract String
    serializeEvent(org.apache.logging.log4j.core.LogEvent event)
    Mutable LogEvent which masks messages using global and local regex strings, and shortens the message to a maximum length, if necessary.
    static void
    setMaxLength(int maxLength)
     
    static void
     
    final String
    toSerializable(org.apache.logging.log4j.core.LogEvent logEvent)
     

    Methods inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout

    getBytes, getCharset, getContentType, getFooter, getFooterSerializer, getHeader, getHeaderSerializer, getStringBuilder, getStringBuilderEncoder, requiresLocation, serializeToBytes, serializeToString, toByteArray, trimToMaxSize

    Methods inherited from class org.apache.logging.log4j.core.layout.AbstractLayout

    encode, getConfiguration, getContentFormat, markEvent

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.apache.logging.log4j.core.layout.Encoder

    encode

    Methods inherited from interface org.apache.logging.log4j.core.Layout

    getContentFormat
  • Constructor Details

    • IbisMaskingLayout

      protected IbisMaskingLayout(org.apache.logging.log4j.core.config.Configuration config, Charset charset)
      Parameters:
      config -
      charset - defaults to the system's default
  • Method Details

    • toSerializable

      public final String toSerializable(org.apache.logging.log4j.core.LogEvent logEvent)
    • serializeEvent

      protected abstract String serializeEvent(org.apache.logging.log4j.core.LogEvent event)
      Mutable LogEvent which masks messages using global and local regex strings, and shortens the message to a maximum length, if necessary.
      Parameters:
      event - Event to be serialized to a String.
      Returns:
      Serialized and masked event.
    • setMaxLength

      public static void setMaxLength(int maxLength)
    • getMaxLength

      public static int getMaxLength()
    • getMoreMessageString

      public static String getMoreMessageString()
    • setMoreMessageString

      public static void setMoreMessageString(String moreMessage)
    • addToGlobalReplace

      public static void addToGlobalReplace(String regex)
    • removeFromGlobalReplace

      public static void removeFromGlobalReplace(String regex)
    • getGlobalReplace

      public static Set<String> getGlobalReplace()
    • cleanGlobalReplace

      public static void cleanGlobalReplace()
    • addToThreadLocalReplace

      public static void addToThreadLocalReplace(Collection<String> collection)
    • addToThreadLocalReplace

      public static void addToThreadLocalReplace(String regex)
      Add regex to hide locally, meaning for specific threads/adapters. This used to be LogUtil.setThreadHideRegex(String hideRegex)
    • removeFromThreadLocalReplace

      public static void removeFromThreadLocalReplace(String regex)
      Remove regex to hide locally, meaning for specific threads/adapters. When the last item is removed the Set will be removed as well.
    • getThreadLocalReplace

      public static Set<String> getThreadLocalReplace()
      Set of regex strings to hide locally, meaning for specific threads/adapters. Can return null when not used/initalized!
    • removeThreadLocalReplace

      public static void removeThreadLocalReplace()