Package org.apache.logging.log4j.core
Interface Layout<T extends Serializable>
-
- Type Parameters:
T
- TheSerializable
type returned bytoSerializable(LogEvent)
- All Known Subinterfaces:
StringLayout
- All Known Implementing Classes:
AbstractLayout
,AbstractStringLayout
,HtmlLayout
,LayoutAdapter
,Log4j1XmlLayout
,MessageLayout
,PatternLayout
,Rfc5424Layout
,SerializedLayout
,SyslogLayout
public interface Layout<T extends Serializable> extends Encoder<LogEvent>
Lays out a LogEvent in different formats. The formats are:-
byte[]
-
an implementer of Serializable, like
byte[]
- String
- LogEvent
Since 2.6, Layouts can encode a
LogEvent
directly to aByteBufferDestination
without creating temporary intermediary objects.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ELEMENT_TYPE
Main plugin element type for Layout plugins.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.byte[]
toByteArray(LogEvent event)
Formats the event suitable for display.T
toSerializable(LogEvent event)
Formats the event as an Object that can be serialized.
-
-
-
Field Detail
-
ELEMENT_TYPE
static final String ELEMENT_TYPE
Main plugin element type for Layout plugins.- Since:
- 2.1
- See Also:
- Constant Field Values
-
-
Method Detail
-
getFooter
byte[] getFooter()
Returns the format for the layout format.- Returns:
- The footer.
-
getHeader
byte[] getHeader()
Returns the header for the layout format.- Returns:
- The header.
-
toByteArray
byte[] toByteArray(LogEvent event)
Formats the event suitable for display.- Parameters:
event
- The Logging Event.- Returns:
- The formatted event.
-
toSerializable
T toSerializable(LogEvent event)
Formats the event as an Object that can be serialized.- Parameters:
event
- The Logging Event.- Returns:
- The formatted event.
-
getContentType
String getContentType()
Returns the content type output by this layout. The base class returns "text/plain".- Returns:
- the content type.
-
-