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

java.lang.Object
  extended by org.apache.logging.log4j.core.layout.LayoutBase<String>
      extended by org.apache.logging.log4j.core.layout.AbstractStringLayout
          extended by org.apache.logging.log4j.core.layout.HTMLLayout
All Implemented Interfaces:
Layout<String>

public final class HTMLLayout
extends AbstractStringLayout

This layout outputs events in a HTML table.

Appenders using this layout should have their encoding set to UTF-8 or UTF-16, otherwise events containing non ASCII characters could result in corrupted log files.


Field Summary
 
Fields inherited from class org.apache.logging.log4j.core.layout.LayoutBase
footer, header, LOGGER
 
Method Summary
static HTMLLayout createLayout(String locationInfo, String title, String contentType, String charset)
          Create an HTML Layout.
 String formatAs(LogEvent event)
          Format as a String.
 byte[] getFooter()
          Returns the appropriate HTML footers.
 byte[] getHeader()
          Returns appropriate HTML headers.
 
Methods inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout
format, getCharset
 
Methods inherited from class org.apache.logging.log4j.core.layout.LayoutBase
setFooter, setHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

formatAs

public String formatAs(LogEvent event)
Format as a String.

Parameters:
event - The Logging Event.
Returns:
A String containging the LogEvent as HTML.

getHeader

public byte[] getHeader()
Returns appropriate HTML headers.

Specified by:
getHeader in interface Layout<String>
Overrides:
getHeader in class LayoutBase<String>
Returns:
The header as a byte array.

getFooter

public byte[] getFooter()
Returns the appropriate HTML footers.

Specified by:
getFooter in interface Layout<String>
Overrides:
getFooter in class LayoutBase<String>
Returns:
the footer as a byet array.

createLayout

public static HTMLLayout createLayout(String locationInfo,
                                      String title,
                                      String contentType,
                                      String charset)
Create an HTML Layout.

Parameters:
locationInfo - If "true", location information will be included. The default is false.
title - The title to include in the file header. If none is specified the default title will be used.
contentType - The content type. Defaults to "text/html".
charset - The character set to use. If not specified, the default will be used.
Returns:
An HTML Layout.


Copyright © 1999-2012 Apache Software Foundation. All Rights Reserved.