Class MessageLayout
- java.lang.Object
-
- org.apache.logging.log4j.core.layout.AbstractLayout<Message>
-
- org.apache.logging.log4j.core.layout.MessageLayout
-
@Plugin(name="MessageLayout", category="Core", elementType="layout", printObject=true) public class MessageLayout extends AbstractLayout<Message>
Formats aLogEventin itsMessageform.Useful in combination with a JMS Appender to map a Log4j
MapMessageorStringMapMessageto a JMSMapMessage.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
AbstractLayout.Builder<B extends AbstractLayout.Builder<B>>
-
-
Field Summary
-
Fields inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
configuration, eventCount, footer, header, LOGGER
-
Fields inherited from interface org.apache.logging.log4j.core.Layout
ELEMENT_TYPE
-
-
Constructor Summary
Constructors Constructor Description MessageLayout()MessageLayout(Configuration configuration, byte[] header, byte[] footer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Layout<?>createLayout()java.lang.StringgetContentType()Returns the content type output by this layout.byte[]toByteArray(LogEvent event)Formats the event suitable for display.MessagetoSerializable(LogEvent event)Formats the event as an Object that can be serialized.-
Methods inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
encode, getConfiguration, getContentFormat, getFooter, getHeader, markEvent
-
-
-
-
Constructor Detail
-
MessageLayout
public MessageLayout()
-
MessageLayout
public MessageLayout(Configuration configuration, byte[] header, byte[] footer)
-
-
Method Detail
-
toByteArray
public byte[] toByteArray(LogEvent event)
Description copied from interface:LayoutFormats the event suitable for display.- Parameters:
event- The Logging Event.- Returns:
- The formatted event.
-
toSerializable
public Message toSerializable(LogEvent event)
Description copied from interface:LayoutFormats the event as an Object that can be serialized.- Parameters:
event- The Logging Event.- Returns:
- The formatted event.
-
getContentType
public java.lang.String getContentType()
Description copied from interface:LayoutReturns the content type output by this layout. The base class returns "text/plain".- Returns:
- the content type.
-
createLayout
@PluginFactory public static Layout<?> createLayout()
-
-