org.apache.log4j
Class Layout
java.lang.Object
|
+--org.apache.log4j.spi.ComponentBase
|
+--org.apache.log4j.Layout
- All Implemented Interfaces:
- Component, OptionHandler
- Direct Known Subclasses:
- DateLayout, HTMLLayout, PatternLayout, SimpleLayout, XMLLayout
- public abstract class Layout
- extends ComponentBase
- implements OptionHandler
Extend this abstract class to create your own log layout format.
- Author:
- Ceki Gülcü, Chris Nokes
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LINE_SEP
public static final String LINE_SEP
LINE_SEP_LEN
public static final int LINE_SEP_LEN
ignoresThrowable
protected boolean ignoresThrowable
Layout
public Layout()
format
public abstract String format(LoggingEvent event)
- Implement this method to create your own layout format.
getContentType
public String getContentType()
- Returns the content type output by this layout. The base class
returns "text/plain".
getHeader
public String getHeader()
- Returns the header for the layout format. There is no default header.
getFooter
public String getFooter()
- Returns the footer for the layout format. There is no default footer.
ignoresThrowable
public 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
.
By default, SimpleLayout
, TTCCLayout
, PatternLayout
all return true
. The XMLLayout
returns false
.
As of log4j version 1.3, ignoresThrowable is a settable property. Thus,
you can override a layout's default setting.
- Since:
- 0.8.4
setIgnoresThrowable
public void setIgnoresThrowable(boolean ignoresThrowable)
- Parameters:
ignoresThrowable
- - Since:
- 1.3
setFooter
public void setFooter(String footer)
- Set the footer. Note that some layout have their own footers and may choose
to ignote the footer set here.
- Parameters:
footer
- the footer- Since:
- 1.3
setHeader
public void setHeader(String header)
- Set the header. Note that some layout have their own headers and may choose
to ignote the header set here.
- Parameters:
header
- the header- Since:
- 1.3
Copyright © 2000-2006 Apache Software Foundation.
Licensed under the Apache License, Version 2.0.