Log4j 1.0.4

org.apache.log4j
Class HTMLLayout

java.lang.Object
  |
  +--org.apache.log4j.Layout
        |
        +--org.apache.log4j.HTMLLayout
All Implemented Interfaces:
OptionHandler

public class HTMLLayout
extends Layout


Field Summary
protected  int BUF_SIZE
           
static String LOCATION_INFO_OPTION
          A string constant used in naming the option for setting the the location information flag.
protected  int MAX_CAPACITY
           
 
Fields inherited from class org.apache.log4j.Layout
LINE_SEP, LINE_SEP_LEN
 
Constructor Summary
HTMLLayout()
           
 
Method Summary
 void activateOptions()
          Activate the options that were previously set with calls to setOption.
 String format(LoggingEvent event)
          Implement this method to create your own layout format.
 String getContentType()
          Returns the content type output by this layout, i.e "text/html".
 String getFooter()
          Returns the appropriate HTML footers.
 String getHeader()
          Returns appropriate HTML headers.
 String[] getOptionStrings()
          Return list of strings that the OptionHandler instance recognizes.
 boolean ignoresThrowable()
          If the layout handles the throwable object contained within LoggingEvent, then the layout should return false.
 void setOption(String key, String value)
          Set HTMLLayout specific options.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUF_SIZE

protected final int BUF_SIZE

MAX_CAPACITY

protected final int MAX_CAPACITY

LOCATION_INFO_OPTION

public static final String LOCATION_INFO_OPTION
A string constant used in naming the option for setting the the location information flag. Current value of this string constant is LocationInfo.

Note that all option keys are case sensitive.

Constructor Detail

HTMLLayout

public HTMLLayout()
Method Detail

activateOptions

public void activateOptions()
Description copied from interface: OptionHandler
Activate the options that were previously set with calls to setOption.

This allows to defer activiation of the options until all options have been set. This is required for components which have related options that remain ambigous until all are set.

For example, the FileAppender has the "File" and "Append" options both of which are ambigous until the other is also set.


format

public String format(LoggingEvent event)
Description copied from class: Layout
Implement this method to create your own layout format.
Overrides:
format in class Layout

getContentType

public String getContentType()
Returns the content type output by this layout, i.e "text/html".
Overrides:
getContentType in class Layout

getHeader

public String getHeader()
Returns appropriate HTML headers.
Overrides:
getHeader in class Layout

getFooter

public String getFooter()
Returns the appropriate HTML footers.
Overrides:
getFooter in class Layout

getOptionStrings

public String[] getOptionStrings()
Description copied from interface: OptionHandler
Return list of strings that the OptionHandler instance recognizes.

ignoresThrowable

public boolean ignoresThrowable()
Description copied from class: Layout
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.

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

Overrides:
ignoresThrowable in class Layout

setOption

public void setOption(String key,
                      String value)
Set HTMLLayout specific options.

The LocationInfo option takes a boolean value. By default, it is set to false which means there will be no location information output by this layoout. If the the option is set to true, then the file name and line number of the statement at the origin of the log statement will be output.

If you are embedding this layout within an SMTPAppender then make sure to set the LocationInfo option of that appender as well.


Log4j 1.0.4

Please notify me about new log4j releases.