Package com.logicaldoc.web.util
Class HTMLLayout
- java.lang.Object
-
- org.apache.log4j.Layout
-
- com.logicaldoc.web.util.HTMLLayout
-
- All Implemented Interfaces:
org.apache.log4j.spi.OptionHandler
public class HTMLLayout extends org.apache.log4j.Layout
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.- Author:
- Ceki Gülcü, Marco Meschieri
-
-
Field Summary
Fields Modifier and Type Field Description static String
TITLE_OPTION
A string constant used in naming the option for setting the the HTML document title.
-
Constructor Summary
Constructors Constructor Description HTMLLayout()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activateOptions()
No options to activateString
format(org.apache.log4j.spi.LoggingEvent event)
String
getContentType()
Returns the content type output by this layout, i.e "text/html"String
getFooter()
Returns the appropriate HTML footersString
getHeader()
Returns appropriate HTML headersboolean
getLocationInfo()
Returns the current value of the LocationInfo optionString
getTitle()
Returns the current value of the Title optionboolean
ignoresThrowable()
The HTML layout handles the throwable contained in logging events.void
setLocationInfo(boolean flag)
The LocationInfo option takes a boolean value.void
setTitle(String title)
The Title option takes a String value.
-
-
-
Field Detail
-
TITLE_OPTION
public static final String TITLE_OPTION
A string constant used in naming the option for setting the the HTML document title. Current value of this string constant is Title.- See Also:
- Constant Field Values
-
-
Method Detail
-
setLocationInfo
public void setLocationInfo(boolean flag)
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 layout. 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 outputIf you are embedding this layout within an
SMTPAppender
then make sure to set the LocationInfo option of that appender as well- Parameters:
flag
- the flag
-
getLocationInfo
public boolean getLocationInfo()
Returns the current value of the LocationInfo option- Returns:
- the LocationInfo options
-
setTitle
public void setTitle(String title)
The Title option takes a String value. This option sets the document title of the generated HTML document.
Defaults to 'Log4J Log Messages'.- Parameters:
title
- the title
-
getTitle
public String getTitle()
Returns the current value of the Title option- Returns:
- the title
-
getContentType
public String getContentType()
Returns the content type output by this layout, i.e "text/html"- Overrides:
getContentType
in classorg.apache.log4j.Layout
- Returns:
- the content type
-
activateOptions
public void activateOptions()
No options to activate
-
format
public String format(org.apache.log4j.spi.LoggingEvent event)
- Specified by:
format
in classorg.apache.log4j.Layout
-
getHeader
public String getHeader()
Returns appropriate HTML headers- Overrides:
getHeader
in classorg.apache.log4j.Layout
- Returns:
- the HTML headers
-
getFooter
public String getFooter()
Returns the appropriate HTML footers- Overrides:
getFooter
in classorg.apache.log4j.Layout
- Returns:
- the footer
-
ignoresThrowable
public boolean ignoresThrowable()
The HTML layout handles the throwable contained in logging events. Hence, this method returnfalse
- Specified by:
ignoresThrowable
in classorg.apache.log4j.Layout
- Returns:
- the flag
-
-