org.apache.logging.log4j.core.layout
Class SerializedLayout

java.lang.Object
  extended by org.apache.logging.log4j.core.layout.AbstractLayout<LogEvent>
      extended by org.apache.logging.log4j.core.layout.SerializedLayout
All Implemented Interfaces:
Layout<LogEvent>

@Plugin(name="SerializedLayout",
        category="Core",
        elementType="layout",
        printObject=true)
public final class SerializedLayout
extends AbstractLayout<LogEvent>

Formats a LogEvent in its Java serialized form.


Field Summary
 
Fields inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
footer, header, LOGGER
 
Method Summary
static SerializedLayout createLayout()
          Creates a SerializedLayout.
 Map<String,String> getContentFormat()
          SerializedLayout's format is sufficiently specified via the content type, use empty Map/unspecified.
 String getContentType()
          SerializedLayout returns a binary stream.
 byte[] getHeader()
          Returns the header, if one is available.
 byte[] toByteArray(LogEvent event)
          Formats a LogEvent as a serialized byte array of the LogEvent object.
 LogEvent toSerializable(LogEvent event)
          Returns the LogEvent.
 
Methods inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
getFooter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toByteArray

public byte[] toByteArray(LogEvent event)
Formats a LogEvent as a serialized byte array of the LogEvent object.

Parameters:
event - The LogEvent.
Returns:
the formatted LogEvent.

toSerializable

public LogEvent toSerializable(LogEvent event)
Returns the LogEvent.

Parameters:
event - The Logging Event.
Returns:
The LogEvent.

createLayout

@PluginFactory
public static SerializedLayout createLayout()
Creates a SerializedLayout.

Returns:
A SerializedLayout.

getHeader

public byte[] getHeader()
Description copied from class: AbstractLayout
Returns the header, if one is available.

Specified by:
getHeader in interface Layout<LogEvent>
Overrides:
getHeader in class AbstractLayout<LogEvent>
Returns:
A byte array containing the header.

getContentFormat

public Map<String,String> getContentFormat()
SerializedLayout's format is sufficiently specified via the content type, use empty Map/unspecified.

Returns:
empty Map

getContentType

public String getContentType()
SerializedLayout returns a binary stream.

Returns:
The content type.


Copyright © 1999-2014 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.