Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

    java.lang.Object
      org.apache.logging.log4j.core.layout.AbstractLayout<LogEvent>
          org.apache.logging.log4j.core.layout.SerializedLayout

All Implemented Interfaces:
  Serializable, 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.

See Also:
  Serialized Form

Field Summary

Fields inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
`footer, header, LOGGER`

Fields inherited from interface org.apache.logging.log4j.core.Layout
`ELEMENT_TYPE`

Method Summary
`static SerializedLayout` | `createLayout()` Creates a SerializedLayout.
`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
`getContentFormat, 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.

### getContentType

    public String getContentType()

  SerializedLayout returns a binary stream.

  Returns:
    The content type.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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