Class SyslogLayout
java.lang.Object
org.apache.logging.log4j.core.layout.AbstractLayout<String>
org.apache.logging.log4j.core.layout.AbstractStringLayout
org.apache.logging.log4j.core.layout.SyslogLayout
- All Implemented Interfaces:
LocationAware,Layout<String>,Encoder<LogEvent>,StringLayout
@Plugin(name="SyslogLayout",
category="Core",
elementType="layout",
printObject=true)
public final class SyslogLayout
extends AbstractStringLayout
Formats a log event as a BSD Log record.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSyslogLayout.Builder<B extends SyslogLayout.Builder<B>>Builds a SyslogLayout.Nested classes/interfaces inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout
AbstractStringLayout.Serializer, AbstractStringLayout.Serializer2 -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PatternMatch newlines in a platform-independent manner.Fields inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout
DEFAULT_STRING_BUILDER_SIZE, MAX_STRING_BUILDER_SIZEFields inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
configuration, eventCount, footer, header, LOGGERFields inherited from interface org.apache.logging.log4j.core.Layout
ELEMENT_TYPE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSyslogLayout(Facility facility, boolean includeNL, String escapeNL, Charset charset) -
Method Summary
Modifier and TypeMethodDescriptionstatic SyslogLayoutcreateLayout(Facility facility, boolean includeNewLine, String escapeNL, Charset charset) Deprecated.Gets this SyslogLayout's content format.Gets the facility.static <B extends SyslogLayout.Builder<B>>
BtoSerializable(LogEvent event) Formats aLogEventin conformance with the BSD Log record format.Methods inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout
getBytes, getCharset, getContentType, getFooter, getFooterSerializer, getHeader, getHeaderSerializer, getStringBuilder, getStringBuilderEncoder, requiresLocation, serializeToBytes, serializeToString, toByteArray, trimToMaxSizeMethods inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
encode, getConfiguration, markEvent
-
Field Details
-
NEWLINE_PATTERN
Match newlines in a platform-independent manner.
-
-
Constructor Details
-
SyslogLayout
-
-
Method Details
-
newBuilder
-
toSerializable
Formats aLogEventin conformance with the BSD Log record format.- Parameters:
event- The LogEvent- Returns:
- the event formatted as a String.
-
getContentFormat
Gets this SyslogLayout's content format. Specified by:- Key: "structured" Value: "false"
- Key: "dateFormat" Value: "MMM dd HH:mm:ss"
- Key: "format" Value: "<LEVEL>TIMESTAMP PROP(HOSTNAME) MESSAGE"
- Key: "formatType" Value: "logfilepatternreceiver" (format uses the keywords supported by LogFilePatternReceiver)
- Specified by:
getContentFormatin interfaceLayout<String>- Overrides:
getContentFormatin classAbstractLayout<String>- Returns:
- Map of content format keys supporting SyslogLayout
-
createLayout
@Deprecated public static SyslogLayout createLayout(Facility facility, boolean includeNewLine, String escapeNL, Charset charset) Deprecated.UsenewBuilder().Creates a SyslogLayout.- Parameters:
facility- The Facility is used to try to classify the message.includeNewLine- If true a newline will be appended to the result.escapeNL- Pattern to use for replacing newlines.charset- The character set.- Returns:
- A SyslogLayout.
-
getFacility
Gets the facility.- Returns:
- the facility
-
newBuilder().