Class GelfLayout.Builder<B extends GelfLayout.Builder<B>>
- java.lang.Object
-
- org.apache.logging.log4j.core.layout.AbstractLayout.Builder<B>
-
- org.apache.logging.log4j.core.layout.AbstractStringLayout.Builder<B>
-
- org.apache.logging.log4j.core.layout.GelfLayout.Builder<B>
-
- All Implemented Interfaces:
Builder<GelfLayout>
- Enclosing class:
- GelfLayout
public static class GelfLayout.Builder<B extends GelfLayout.Builder<B>> extends AbstractStringLayout.Builder<B> implements Builder<GelfLayout>
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GelfLayout
build()
Builds the object after all configuration has been set.KeyValuePair[]
getAdditionalFields()
int
getCompressionThreshold()
GelfLayout.CompressionType
getCompressionType()
java.lang.String
getHost()
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(java.lang.String host)
The value of thehost
property (optional, defaults to local host name).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).-
Methods inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout.Builder
getCharset, getFooterSerializer, getHeaderSerializer, setCharset, setFooterSerializer, setHeaderSerializer
-
Methods inherited from class org.apache.logging.log4j.core.layout.AbstractLayout.Builder
asBuilder, getConfiguration, getFooter, getHeader, setConfiguration, setFooter, setHeader
-
-
-
-
Method Detail
-
build
public GelfLayout build()
Description copied from interface:Builder
Builds the object after all configuration has been set. This will use default values for any unspecified attributes for the object.- Specified by:
build
in interfaceBuilder<B extends GelfLayout.Builder<B>>
- Returns:
- the configured instance.
-
getHost
public java.lang.String getHost()
-
getCompressionType
public GelfLayout.CompressionType getCompressionType()
-
getCompressionThreshold
public int getCompressionThreshold()
-
isIncludeStacktrace
public boolean isIncludeStacktrace()
-
isIncludeThreadContext
public boolean isIncludeThreadContext()
-
isIncludeNullDelimiter
public boolean isIncludeNullDelimiter()
-
getAdditionalFields
public KeyValuePair[] getAdditionalFields()
-
setHost
public B setHost(java.lang.String host)
The value of thehost
property (optional, defaults to local host name).- Returns:
- this builder
-
setCompressionType
public B setCompressionType(GelfLayout.CompressionType compressionType)
Compression to use (optional, defaults to GZIP).- Returns:
- this builder
-
setCompressionThreshold
public B setCompressionThreshold(int compressionThreshold)
Compress if data is larger than this number of bytes (optional, defaults to 1024).- Returns:
- this builder
-
setIncludeStacktrace
public B setIncludeStacktrace(boolean includeStacktrace)
Whether to include full stacktrace of logged Throwables (optional, default to true). If set to false, only the class name and message of the Throwable will be included.- Returns:
- this builder
-
setIncludeThreadContext
public B setIncludeThreadContext(boolean includeThreadContext)
Whether to include thread context as additional fields (optional, default to true).- Returns:
- this builder
-
setIncludeNullDelimiter
public B setIncludeNullDelimiter(boolean includeNullDelimiter)
Whether to include NULL byte as delimiter after each event (optional, default to false). Useful for Graylog GELF TCP input.- Returns:
- this builder
-
setAdditionalFields
public B setAdditionalFields(KeyValuePair[] additionalFields)
Additional fields to set on each log event.- Returns:
- this builder
-
-