public abstract class

Layout

extends Object
implements OptionHandler
java.lang.Object
   ↳ org.apache.log4j.Layout
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Extend this abstract class to create your own log layout format.

Summary

Fields
public static final String LINE_SEP
public static final int LINE_SEP_LEN
Public Constructors
Layout()
Public Methods
abstract String format(LoggingEvent event)
Implement this method to create your own layout format.
String getContentType()
Returns the content type output by this layout.
String getFooter()
Returns the footer for the layout format.
String getHeader()
Returns the header for the layout format.
abstract boolean ignoresThrowable()
If the layout handles the throwable object contained within LoggingEvent, then the layout should return false.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.log4j.spi.OptionHandler

Fields

public static final String LINE_SEP

public static final int LINE_SEP_LEN

Public Constructors

public Layout ()

Public Methods

public abstract String format (LoggingEvent event)

Implement this method to create your own layout format.

public String getContentType ()

Returns the content type output by this layout. The base class returns "text/plain".

public String getFooter ()

Returns the footer for the layout format. The base class returns null.

public String getHeader ()

Returns the header for the layout format. The base class returns null.

public abstract boolean ignoresThrowable ()

If the layout handles the throwable object contained within LoggingEvent, then the layout should return false. Otherwise, if the layout ignores throwable object, then the layout should return true. If ignoresThrowable is true, the appender is responsible for rendering the throwable.

The SimpleLayout, TTCCLayout, PatternLayout all return true. The XMLLayout returns false.