public static class GelfLayout.Builder<B extends GelfLayout.Builder<B>> extends AbstractStringLayout.Builder<B> implements Builder<GelfLayout>
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
GelfLayout |
build()
Builds the object after all configuration has been set.
|
KeyValuePair[] |
getAdditionalFields() |
int |
getCompressionThreshold() |
GelfLayout.CompressionType |
getCompressionType() |
String |
getHost() |
boolean |
isIncludeNewLineDelimiter() |
boolean |
isIncludeNullDelimiter() |
boolean |
isIncludeStacktrace() |
boolean |
isIncludeThreadContext() |
B |
setAdditionalFields(KeyValuePair[] additionalFields)
Additional fields to set on each log event.
|
B |
setCompressionThreshold(int compressionThreshold)
Compress if data is larger than this number of bytes (optional, defaults to 1024).
|
B |
setCompressionType(GelfLayout.CompressionType compressionType)
Compression to use (optional, defaults to GZIP).
|
B |
setHost(String host)
The value of the
host property (optional, defaults to local host name). |
B |
setIncludeMapMessage(boolean includeMapMessage)
Whether to include MapMessage fields as additional fields (optional, default to true).
|
B |
setIncludeNewLineDelimiter(boolean includeNewLineDelimiter)
Whether to include newline (LF) as delimiter after each event (optional, default to false).
|
B |
setIncludeNullDelimiter(boolean includeNullDelimiter)
Whether to include NULL byte as delimiter after each event (optional, default to false).
|
B |
setIncludeStacktrace(boolean includeStacktrace)
Whether to include full stacktrace of logged Throwables (optional, default to true).
|
B |
setIncludeThreadContext(boolean includeThreadContext)
Whether to include thread context as additional fields (optional, default to true).
|
B |
setMapMessageExcludes(String mapMessageExcludes)
A comma separated list of MapMessage keys to exclude;
|
B |
setMapMessageIncludes(String mapMessageIncludes)
A comma separated list of thread context keys to include;
|
B |
setMapPrefix(String prefix)
The String to prefix the MapMessage attributes.
|
B |
setMdcExcludes(String mdcExcludes)
A comma separated list of thread context keys to include;
|
B |
setMdcIncludes(String mdcIncludes)
A comma separated list of thread context keys to include;
|
B |
setMessagePattern(String pattern)
The pattern to use to format the message.
|
B |
setPatternSelector(PatternSelector patternSelector)
The PatternSelector to use to format the message.
|
B |
setThreadContextPrefix(String prefix)
The String to prefix the ThreadContext attributes.
|
getCharset, getFooterSerializer, getHeaderSerializer, setCharset, setFooterSerializer, setHeaderSerializer
asBuilder, getConfiguration, getFooter, getHeader, setConfiguration, setFooter, setHeader
public Builder()
public GelfLayout build()
Builder
build
in interface Builder<GelfLayout>
public GelfLayout.CompressionType getCompressionType()
public int getCompressionThreshold()
public boolean isIncludeStacktrace()
public boolean isIncludeThreadContext()
public boolean isIncludeNullDelimiter()
public boolean isIncludeNewLineDelimiter()
public KeyValuePair[] getAdditionalFields()
public B setHost(String host)
host
property (optional, defaults to local host name).public B setCompressionType(GelfLayout.CompressionType compressionType)
public B setCompressionThreshold(int compressionThreshold)
public B setIncludeStacktrace(boolean includeStacktrace)
public B setIncludeThreadContext(boolean includeThreadContext)
public B setIncludeNullDelimiter(boolean includeNullDelimiter)
public B setIncludeNewLineDelimiter(boolean includeNewLineDelimiter)
public B setAdditionalFields(KeyValuePair[] additionalFields)
public B setMessagePattern(String pattern)
pattern
- the pattern string.public B setPatternSelector(PatternSelector patternSelector)
patternSelector
- the PatternSelector.public B setMdcIncludes(String mdcIncludes)
mdcIncludes
- the list of keys.public B setMdcExcludes(String mdcExcludes)
mdcExcludes
- the list of keys.public B setIncludeMapMessage(boolean includeMapMessage)
public B setMapMessageIncludes(String mapMessageIncludes)
mapMessageIncludes
- the list of keys.public B setMapMessageExcludes(String mapMessageExcludes)
mapMessageExcludes
- the list of keys.public B setThreadContextPrefix(String prefix)
prefix
- The prefix value. Null values will be ignored.public B setMapPrefix(String prefix)
prefix
- The prefix value. Null values will be ignored.Copyright © 1999-2021 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.