org.apache.logging.log4j.core.layout
Class AbstractLayout<T extends Serializable>

java.lang.Object
  extended by org.apache.logging.log4j.core.layout.AbstractLayout<T>
Type Parameters:
T - The Class that the Layout will format the LogEvent into.
All Implemented Interfaces:
Serializable, Layout<T>
Direct Known Subclasses:
AbstractStringLayout, SerializedLayout

public abstract class AbstractLayout<T extends Serializable>
extends Object
implements Layout<T>, Serializable

Abstract base class for Layouts.

See Also:
Serialized Form

Field Summary
protected  byte[] footer
          The footer to add when the stream is closed.
protected  byte[] header
          The header to include when the stream is opened.
protected static org.apache.logging.log4j.Logger LOGGER
          Allow subclasses access to the status logger without creating another instance.
 
Fields inherited from interface org.apache.logging.log4j.core.Layout
ELEMENT_TYPE
 
Constructor Summary
AbstractLayout(byte[] header, byte[] footer)
          Constructs a layout with an optional header and footer.
 
Method Summary
 Map<String,String> getContentFormat()
          Returns a description of the content format.
 byte[] getFooter()
          Returns the footer, if one is available.
 byte[] getHeader()
          Returns the header, if one is available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.logging.log4j.core.Layout
getContentType, toByteArray, toSerializable
 

Field Detail

LOGGER

protected static final org.apache.logging.log4j.Logger LOGGER
Allow subclasses access to the status logger without creating another instance.


header

protected final byte[] header
The header to include when the stream is opened. May be null.


footer

protected final byte[] footer
The footer to add when the stream is closed. May be null.

Constructor Detail

AbstractLayout

public AbstractLayout(byte[] header,
                      byte[] footer)
Constructs a layout with an optional header and footer.

Parameters:
header - The header to include when the stream is opened. May be null.
footer - The footer to add when the stream is closed. May be null.
Method Detail

getContentFormat

public Map<String,String> getContentFormat()
Description copied from interface: Layout
Returns a description of the content format.

Specified by:
getContentFormat in interface Layout<T extends Serializable>
Returns:
a Map of key/value pairs describing the Layout-specific content format, or an empty Map if no content format descriptors are specified.

getFooter

public byte[] getFooter()
Returns the footer, if one is available.

Specified by:
getFooter in interface Layout<T extends Serializable>
Returns:
A byte array containing the footer.

getHeader

public byte[] getHeader()
Returns the header, if one is available.

Specified by:
getHeader in interface Layout<T extends Serializable>
Returns:
A byte array containing the header.


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.