Class Rfc5424Layout.Rfc5424LayoutBuilder
- java.lang.Object
-
- org.apache.logging.log4j.core.layout.AbstractLayout.Builder<B>
-
- org.apache.logging.log4j.core.layout.AbstractStringLayout.Builder<Rfc5424Layout.Rfc5424LayoutBuilder>
-
- org.apache.logging.log4j.core.layout.Rfc5424Layout.Rfc5424LayoutBuilder
-
- All Implemented Interfaces:
Builder<Rfc5424Layout>
- Enclosing class:
- Rfc5424Layout
public static class Rfc5424Layout.Rfc5424LayoutBuilder extends AbstractStringLayout.Builder<Rfc5424Layout.Rfc5424LayoutBuilder> implements Builder<Rfc5424Layout>
- Since:
- 2.21.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringappNameThe value to use as theAPP-NAMEin the RFC 5424 syslog record.private java.lang.StringeinThe enterprise number to include inSD-IDidentifiers.private java.lang.IntegerenterpriseNumberThe enterprise number to include inSD-IDidentifiers.private java.lang.StringescapeNLSame asnewLineEscape.private java.lang.StringeventPrefixA prefix to add to event key names when formattingStructuredDataMessagefields.private java.lang.StringexceptionPatternThe pattern used to format exceptions appended to the syslog message.private java.lang.StringexcludesSame asmdcExcludes.private FacilityfacilityThe name of theFacilityas described in RFC 5424private java.lang.StringidThe defaultSD-IDas described in RFC 5424.private booleanincludeMDCIndicates whether data from the context map will be included as RFC 5424SD-ELEMENT.private booleanincludeNLSame asnewLine.private java.lang.StringincludesSame asmdcIncludes.private LoggerFields[]loggerFieldsOptional additionalSD-ELEMENTs.private java.lang.StringmdcExcludesA comma separated list of MDC keys that should be excluded from the LogEvent.private java.lang.StringmdcIdThe id to use for the MDC Structured Data Element.private java.lang.StringmdcIncludesA comma separated list of MDC keys that should be included in the LogEvent.private java.lang.StringmdcPrefixA prefix to add to MDC key names when formatting them as structured data parameters.private java.lang.StringmdcRequiredA comma separated list of MDC keys that must be present in the MDC.private java.lang.StringmessageIdThe default value to be used in theMSGIDfield of RFC 5424 syslog records.private booleannewLineIftrue, a newline will be appended to the end of the syslog record.private java.lang.StringnewLineEscapeIf set, this string will be used to replace new lines within the message text.private java.lang.StringrequiredSame asmdcRequired.private booleanuseTlsMessageFormatIf true the message will be formatted according to RFC 5425.private booleanuseTLSMessageFormatSame asuseTlsMessageFormat.
-
Constructor Summary
Constructors Constructor Description Rfc5424LayoutBuilder()
-
Method Summary
-
Methods inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout.Builder
getCharset, getFooterSerializer, getHeaderSerializer, setFooterSerializer, setHeaderSerializer
-
Methods inherited from class org.apache.logging.log4j.core.layout.AbstractLayout.Builder
asBuilder, getConfiguration, getFooter, getHeader, setConfiguration, setFooter, setHeader
-
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.util.Builder
getErrorPrefix, isValid
-
-
-
-
Field Detail
-
facility
@PluginBuilderAttribute private Facility facility
The name of theFacilityas described in RFC 5424The matching is case-insensitive. Defaults to
LOCAL0.
-
id
@PluginBuilderAttribute private java.lang.String id
The defaultSD-IDas described in RFC 5424.
-
ein
@PluginBuilderAttribute private java.lang.String ein
The enterprise number to include inSD-IDidentifiers.Can contain multiple integers separated by a dot, for example
32473.1Defaults to 32473.
-
enterpriseNumber
@PluginBuilderAttribute private java.lang.Integer enterpriseNumber
The enterprise number to include inSD-IDidentifiers.Limited to a single integer.
Defaults to 32473.
-
includeMDC
@PluginBuilderAttribute private boolean includeMDC
Indicates whether data from the context map will be included as RFC 5424SD-ELEMENT.Defaults to
true.
-
newLine
@PluginBuilderAttribute private boolean newLine
Iftrue, a newline will be appended to the end of the syslog record.Default is
false.
-
includeNL
@PluginBuilderAttribute private boolean includeNL
Same asnewLine.Erroneously introduced in version 2.21.0, but kept for compatibility.
-
newLineEscape
@PluginBuilderAttribute private java.lang.String newLineEscape
If set, this string will be used to replace new lines within the message text.By default, new lines are not escaped.
-
escapeNL
@PluginBuilderAttribute private java.lang.String escapeNL
Same asnewLineEscape.Erroneously introduced in version 2.21.0, but kept for compatibility.
-
mdcId
@PluginBuilderAttribute private java.lang.String mdcId
The id to use for the MDC Structured Data Element.Defaults to "mdc".
-
mdcPrefix
@PluginBuilderAttribute private java.lang.String mdcPrefix
A prefix to add to MDC key names when formatting them as structured data parameters.
-
eventPrefix
@PluginBuilderAttribute private java.lang.String eventPrefix
A prefix to add to event key names when formattingStructuredDataMessagefields.
-
appName
@PluginBuilderAttribute private java.lang.String appName
The value to use as theAPP-NAMEin the RFC 5424 syslog record.
-
messageId
@PluginBuilderAttribute private java.lang.String messageId
The default value to be used in theMSGIDfield of RFC 5424 syslog records.If the log event contains a
StructuredDataMessage, the id from that message will be used instead.
-
mdcExcludes
@PluginBuilderAttribute private java.lang.String mdcExcludes
A comma separated list of MDC keys that should be excluded from the LogEvent.Mutually exclusive with
mdcIncludes.
-
excludes
@PluginBuilderAttribute private java.lang.String excludes
Same asmdcExcludes.Erroneously introduced in version 2.21.0, but kept for compatibility.
-
mdcIncludes
@PluginBuilderAttribute private java.lang.String mdcIncludes
A comma separated list of MDC keys that should be included in the LogEvent.Mutually exclusive with
mdcExcludes.
-
includes
@PluginBuilderAttribute private java.lang.String includes
Same asmdcIncludes.Erroneously introduced in version 2.21.0, but kept for compatibility.
-
mdcRequired
@PluginBuilderAttribute private java.lang.String mdcRequired
A comma separated list of MDC keys that must be present in the MDC.
-
required
@PluginBuilderAttribute private java.lang.String required
Same asmdcRequired.Erroneously introduced in version 2.21.0, but kept for compatibility.
-
exceptionPattern
@PluginBuilderAttribute private java.lang.String exceptionPattern
The pattern used to format exceptions appended to the syslog message.
-
useTlsMessageFormat
@PluginBuilderAttribute private boolean useTlsMessageFormat
If true the message will be formatted according to RFC 5425.Default is
false.
-
useTLSMessageFormat
@PluginBuilderAttribute private boolean useTLSMessageFormat
Same asuseTlsMessageFormat.Erroneously introduced in version 2.21.0, but kept for compatibility.
-
loggerFields
@PluginElement("loggerFields") private LoggerFields[] loggerFields
Optional additionalSD-ELEMENTs.Each
LoggerFieldsentry contains a set of key/value patterns to produce structured data parameters.
-
-
Method Detail
-
setConfig
@Deprecated public Rfc5424Layout.Rfc5424LayoutBuilder setConfig(Configuration config)
Deprecated.Since 2.24.0 useAbstractLayout.Builder.setConfiguration(org.apache.logging.log4j.core.config.Configuration)instead.
-
setFacility
public Rfc5424Layout.Rfc5424LayoutBuilder setFacility(Facility facility)
-
setId
public Rfc5424Layout.Rfc5424LayoutBuilder setId(java.lang.String id)
-
setEin
public Rfc5424Layout.Rfc5424LayoutBuilder setEin(java.lang.String ein)
-
setIncludeMDC
public Rfc5424Layout.Rfc5424LayoutBuilder setIncludeMDC(boolean includeMDC)
-
setIncludeNL
@Deprecated public Rfc5424Layout.Rfc5424LayoutBuilder setIncludeNL(boolean includeNL)
Deprecated.Since 2.26.0 usesetNewLine(boolean)instead.
-
setNewLine
public Rfc5424Layout.Rfc5424LayoutBuilder setNewLine(boolean newLine)
- Since:
- 2.26.0
-
setEscapeNL
@Deprecated public Rfc5424Layout.Rfc5424LayoutBuilder setEscapeNL(java.lang.String escapeNL)
Deprecated.Since 2.26.0 usesetNewLineEscape(java.lang.String)instead.
-
setNewLineEscape
public Rfc5424Layout.Rfc5424LayoutBuilder setNewLineEscape(java.lang.String newLineEscape)
- Since:
- 2.26.0
-
setMdcId
public Rfc5424Layout.Rfc5424LayoutBuilder setMdcId(java.lang.String mdcId)
-
setMdcPrefix
public Rfc5424Layout.Rfc5424LayoutBuilder setMdcPrefix(java.lang.String mdcPrefix)
-
setEventPrefix
public Rfc5424Layout.Rfc5424LayoutBuilder setEventPrefix(java.lang.String eventPrefix)
-
setAppName
public Rfc5424Layout.Rfc5424LayoutBuilder setAppName(java.lang.String appName)
-
setMessageId
public Rfc5424Layout.Rfc5424LayoutBuilder setMessageId(java.lang.String messageId)
-
setExcludes
@Deprecated public Rfc5424Layout.Rfc5424LayoutBuilder setExcludes(java.lang.String excludes)
Deprecated.since 2.26.0 usesetMdcExcludes(java.lang.String)instead
-
setMdcExcludes
public Rfc5424Layout.Rfc5424LayoutBuilder setMdcExcludes(java.lang.String mdcExcludes)
- Since:
- 2.26.0
-
setIncludes
@Deprecated public Rfc5424Layout.Rfc5424LayoutBuilder setIncludes(java.lang.String includes)
Deprecated.since 2.26.0 usesetMdcIncludes(java.lang.String)instead
-
setMdcIncludes
public Rfc5424Layout.Rfc5424LayoutBuilder setMdcIncludes(java.lang.String mdcIncludes)
- Since:
- 2.26.0
-
setRequired
@Deprecated public Rfc5424Layout.Rfc5424LayoutBuilder setRequired(java.lang.String required)
Deprecated.since 2.26.0 usesetMdcRequired(java.lang.String)instead
-
setMdcRequired
public Rfc5424Layout.Rfc5424LayoutBuilder setMdcRequired(java.lang.String mdcRequired)
- Since:
- 2.26.0
-
setCharset
public Rfc5424Layout.Rfc5424LayoutBuilder setCharset(java.nio.charset.Charset charset)
- Overrides:
setCharsetin classAbstractStringLayout.Builder<Rfc5424Layout.Rfc5424LayoutBuilder>
-
setExceptionPattern
public Rfc5424Layout.Rfc5424LayoutBuilder setExceptionPattern(java.lang.String exceptionPattern)
-
setUseTLSMessageFormat
@Deprecated public Rfc5424Layout.Rfc5424LayoutBuilder setUseTLSMessageFormat(boolean useTLSMessageFormat)
Deprecated.since 2.26.0 usesetUseTlsMessageFormat(boolean)instead
-
setUseTlsMessageFormat
public Rfc5424Layout.Rfc5424LayoutBuilder setUseTlsMessageFormat(boolean useTlsMessageFormat)
- Since:
- 2.26.0
-
setLoggerFields
public Rfc5424Layout.Rfc5424LayoutBuilder setLoggerFields(LoggerFields[] loggerFields)
-
setEnterpriseNumber
public Rfc5424Layout.Rfc5424LayoutBuilder setEnterpriseNumber(java.lang.Integer enterpriseNumber)
- Since:
- 2.25.0
-
build
public Rfc5424Layout build()
Description copied from interface:BuilderBuilds the object after all configuration has been set. This will use default values for any unspecified attributes for the object.- Specified by:
buildin interfaceBuilder<Rfc5424Layout>- Returns:
- the configured instance.
-
-