org.apache.log4j
Class Layout

java.lang.Object
  extended by org.apache.log4j.Layout
Direct Known Subclasses:
PatternLayout

public abstract class Layout
extends Object


Field Summary
static int LINE_SEP_LEN
          Note that the line.separator property can be looked up even by applets.
 
Constructor Summary
Layout()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINE_SEP_LEN

public static final int LINE_SEP_LEN
Note that the line.separator property can be looked up even by applets.

Constructor Detail

Layout

public Layout()
Method Detail

format

public abstract String format(LoggingEvent event)
Implement this method to create your own layout format.

Parameters:
event - The LoggingEvent.
Returns:
The formatted LoggingEvent.

getContentType

public String getContentType()
Returns the content type output by this layout. The base class returns "text/plain".

Returns:
the type of content rendered by the Layout.

getHeader

public String getHeader()
Returns the header for the layout format. The base class returns null.

Returns:
The header.

getFooter

public String getFooter()
Returns the footer for the layout format. The base class returns null.

Returns:
The footer.

ignoresThrowable

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.

Returns:
true if the Layout ignores Throwables.
Since:
0.8.4


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.