Package org.frankframework.logging
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
- 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
ModifierConstructorDescriptionprotected
IbisMaskingLayout
(org.apache.logging.log4j.core.config.Configuration config, Charset charset) -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addToGlobalReplace
(String regex) static void
addToThreadLocalReplace
(String regex) Add regex to hide locally, meaning for specific threads/adapters.static void
addToThreadLocalReplace
(Collection<String> collection) static void
static int
static String
Set of regex strings to hide locally, meaning for specific threads/adapters.static void
removeFromGlobalReplace
(String regex) 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
setMoreMessageString
(String moreMessage) 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
-
serializeEvent
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
-
setMoreMessageString
-
addToGlobalReplace
-
removeFromGlobalReplace
-
getGlobalReplace
-
cleanGlobalReplace
public static void cleanGlobalReplace() -
addToThreadLocalReplace
-
addToThreadLocalReplace
Add regex to hide locally, meaning for specific threads/adapters. This used to be LogUtil.setThreadHideRegex(String hideRegex) -
removeFromThreadLocalReplace
Remove regex to hide locally, meaning for specific threads/adapters. When the last item is removed the Set will be removed as well. -
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()
-