Class SubstituteFilter

java.lang.Object
org.jboss.logmanager.filters.SubstituteFilter
All Implemented Interfaces:
Filter

public final class SubstituteFilter extends Object implements Filter
A filter which applies a text substitution on the message if the nested filter matches.
  • Field Details

    • pattern

      private final Pattern pattern
    • replacement

      private final String replacement
    • replaceAll

      private final boolean replaceAll
  • Constructor Details

    • SubstituteFilter

      public SubstituteFilter(Pattern pattern, String replacement, boolean replaceAll)
      Construct a new instance.
      Parameters:
      pattern - the pattern to match
      replacement - the string replacement
      replaceAll - true if all occurrances should be replaced; false if only the first occurrance
    • SubstituteFilter

      public SubstituteFilter(String patternString, String replacement, boolean replaceAll)
      Construct a new instance.
      Parameters:
      patternString - the pattern to match
      replacement - the string replacement
      replaceAll - true if all occurrances should be replaced; false if only the first occurrance
  • Method Details

    • isLoggable

      public boolean isLoggable(LogRecord record)
      Apply the filter to the given log record.

      The format style will always be set to ExtLogRecord.FormatStyle.NO_FORMAT as the formatted message will be the one used in the replacement.

      Specified by:
      isLoggable in interface Filter
      Parameters:
      record - the log record to inspect and modify
      Returns:
      true always