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

java.lang.Object
  extended by org.apache.logging.log4j.core.layout.AbstractLayout<String>
      extended by org.apache.logging.log4j.core.layout.AbstractStringLayout
All Implemented Interfaces:
Serializable, Layout<String>
Direct Known Subclasses:
GelfLayout, HtmlLayout, JsonLayout, PatternLayout, Rfc5424Layout, SyslogLayout, XmlLayout

public abstract class AbstractStringLayout
extends AbstractLayout<String>

Abstract base class for Layouts that result in a String.

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
 
Constructor Summary
protected AbstractStringLayout(Charset charset)
           
protected AbstractStringLayout(Charset charset, byte[] header, byte[] footer)
           
 
Method Summary
protected  Charset getCharset()
           
 String getContentType()
          Returns the content type output by this layout.
 byte[] toByteArray(LogEvent event)
          Formats the Log Event as a byte array.
 
Methods inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
getContentFormat, getFooter, getHeader
 
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
toSerializable
 

Constructor Detail

AbstractStringLayout

protected AbstractStringLayout(Charset charset)

AbstractStringLayout

protected AbstractStringLayout(Charset charset,
                               byte[] header,
                               byte[] footer)
Method Detail

getCharset

protected Charset getCharset()

getContentType

public String getContentType()
Description copied from interface: Layout
Returns the content type output by this layout. The base class returns "text/plain".

Returns:
The default content type for Strings.

toByteArray

public byte[] toByteArray(LogEvent event)
Formats the Log Event as a byte array.

Parameters:
event - The Log Event.
Returns:
The formatted event as a byte array.


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.