@Plugin(name="JsonTemplateLayout", category="Core", elementType="layout") public class JsonTemplateLayout extends Object implements StringLayout
Modifier and Type | Class and Description |
---|---|
static class |
JsonTemplateLayout.Builder |
static class |
JsonTemplateLayout.EventTemplateAdditionalField |
ELEMENT_TYPE
Modifier and Type | Method and Description |
---|---|
void |
encode(LogEvent event,
ByteBufferDestination destination)
Encodes the specified source object to some binary representation and writes the result to the specified
destination.
|
Charset |
getCharset()
Gets the Charset this layout uses to encode Strings into bytes.
|
Map<String,String> |
getContentFormat()
Returns a description of the content format.
|
String |
getContentType()
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.
|
static JsonTemplateLayout.Builder |
newBuilder() |
byte[] |
toByteArray(LogEvent event)
Formats the event suitable for display.
|
String |
toSerializable(LogEvent event)
Formats the event as an Object that can be serialized.
|
public byte[] toByteArray(LogEvent event)
Layout
toByteArray
in interface Layout<String>
event
- The Logging Event.public String toSerializable(LogEvent event)
Layout
toSerializable
in interface Layout<String>
event
- The Logging Event.public void encode(LogEvent event, ByteBufferDestination destination)
Encoder
public byte[] getFooter()
Layout
public byte[] getHeader()
Layout
public Charset getCharset()
StringLayout
getCharset
in interface StringLayout
public String getContentType()
Layout
getContentType
in interface Layout<String>
public Map<String,String> getContentFormat()
Layout
getContentFormat
in interface Layout<String>
@PluginBuilderFactory public static JsonTemplateLayout.Builder newBuilder()
Copyright © 1999-2021 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.