Class DefaultLayout
- java.lang.Object
-
- org.apache.logging.log4j.core.config.DefaultLayout
-
- All Implemented Interfaces:
Layout<java.lang.String>,Encoder<LogEvent>,StringLayout
final class DefaultLayout extends java.lang.Object implements StringLayout
A simple layout used only byDefaultConfigurationThis layout allows to create applications that don't contain
PatternLayoutand all its patterns, e.g. GraalVM applications.- Since:
- 2.25.0
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static StringLayoutINSTANCE-
Fields inherited from interface org.apache.logging.log4j.core.Layout
ELEMENT_TYPE
-
-
Constructor Summary
Constructors Modifier Constructor Description privateDefaultLayout()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidencode(LogEvent event, ByteBufferDestination destination)Encodes the specified source object to some binary representation and writes the result to the specified destination.java.nio.charset.CharsetgetCharset()Gets the Charset this layout uses to encode Strings into bytes.java.util.Map<java.lang.String,java.lang.String>getContentFormat()Returns a description of the content format.java.lang.StringgetContentType()Returns the content type output by this layout.byte[]getFooter()Returns the format for the layout format.byte[]getHeader()Returns the header for the layout format.byte[]toByteArray(LogEvent event)Formats the event suitable for display.java.lang.StringtoSerializable(LogEvent event)Formats the event as an Object that can be serialized.
-
-
-
Field Detail
-
INSTANCE
static final StringLayout INSTANCE
-
-
Method Detail
-
toSerializable
public java.lang.String toSerializable(LogEvent event)
Description copied from interface:LayoutFormats the event as an Object that can be serialized.- Specified by:
toSerializablein interfaceLayout<java.lang.String>- Parameters:
event- The Logging Event.- Returns:
- The formatted event.
-
toByteArray
public byte[] toByteArray(LogEvent event)
Description copied from interface:LayoutFormats the event suitable for display.- Specified by:
toByteArrayin interfaceLayout<java.lang.String>- Parameters:
event- The Logging Event.- Returns:
- The formatted event.
-
encode
public void encode(LogEvent event, ByteBufferDestination destination)
Description copied from interface:EncoderEncodes the specified source object to some binary representation and writes the result to the specified destination.
-
getContentType
public java.lang.String getContentType()
Description copied from interface:LayoutReturns the content type output by this layout. The base class returns "text/plain".- Specified by:
getContentTypein interfaceLayout<java.lang.String>- Returns:
- the content type.
-
getCharset
public java.nio.charset.Charset getCharset()
Description copied from interface:StringLayoutGets the Charset this layout uses to encode Strings into bytes.- Specified by:
getCharsetin interfaceStringLayout- Returns:
- the Charset this layout uses to encode Strings into bytes.
-
getFooter
public byte[] getFooter()
Description copied from interface:LayoutReturns the format for the layout format.
-
getHeader
public byte[] getHeader()
Description copied from interface:LayoutReturns the header for the layout format.
-
getContentFormat
public java.util.Map<java.lang.String,java.lang.String> getContentFormat()
Description copied from interface:LayoutReturns a description of the content format.- Specified by:
getContentFormatin interfaceLayout<java.lang.String>- Returns:
- a Map of key/value pairs describing the Layout-specific content format, or an empty Map if no content format descriptors are specified.
-
-