Class Log4j1SyslogLayout
java.lang.Object
org.apache.logging.log4j.core.layout.AbstractLayout<String>
org.apache.logging.log4j.core.layout.AbstractStringLayout
org.apache.log4j.layout.Log4j1SyslogLayout
- All Implemented Interfaces:
LocationAware, Layout<String>, Encoder<LogEvent>, StringLayout
@Plugin(name="Log4j1SyslogLayout",
category="Core",
elementType="layout",
printObject=true)
public final class Log4j1SyslogLayout
extends AbstractStringLayout
Port of the layout used by SyslogAppender in Log4j 1.x. Provided for
compatibility with existing Log4j 1 configurations.
Originally developed by Ceki Gülcü and Anders Kristensen.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilds a SyslogLayout.Nested classes/interfaces inherited from class AbstractStringLayout
AbstractStringLayout.Serializer, AbstractStringLayout.Serializer2 -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LogEventPatternConverterprivate static final String[]Date format used if header = true.private final Facilityprivate final booleanprivate final booleanprivate static final StringHost name used to identify messages from this appender.private final StringLayoutFields inherited from class AbstractStringLayout
DEFAULT_STRING_BUILDER_SIZE, MAX_STRING_BUILDER_SIZEFields inherited from class AbstractLayout
configuration, eventCount, footer, LOGGERFields inherited from interface Layout
ELEMENT_TYPE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateLog4j1SyslogLayout(Facility facility, boolean facilityPrinting, boolean header, StringLayout messageLayout, Charset charset) -
Method Summary
Modifier and TypeMethodDescriptionGets this SyslogLayout's content format.static <B extends Log4j1SyslogLayout.Builder<B>>
BtoSerializable(LogEvent event) Formats aLogEventin conformance with the BSD Log record format.Methods inherited from class AbstractStringLayout
getBytes, getCharset, getContentType, getFooter, getFooterSerializer, getHeader, getHeaderSerializer, getStringBuilder, getStringBuilderEncoder, requiresLocation, serializeToBytes, serializeToString, toByteArray, trimToMaxSizeMethods inherited from class AbstractLayout
encode, getConfiguration, markEvent
-
Field Details
-
localHostname
Host name used to identify messages from this appender. -
facility
-
facilityPrinting
private final boolean facilityPrinting -
header
private final boolean header -
messageLayout
-
dateFormatOptions
Date format used if header = true. -
dateConverter
-
-
Constructor Details
-
Log4j1SyslogLayout
private Log4j1SyslogLayout(Facility facility, boolean facilityPrinting, boolean header, StringLayout messageLayout, Charset charset)
-
-
Method Details
-
newBuilder
-
toSerializable
-
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
-