Layout<String>, Encoder<String>, StringLayout@Plugin(name="HtmlLayout", category="Core", elementType="layout", printObject=true) public final class HtmlLayout extends AbstractStringLayout
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.
| Modifier and Type | Class | Description |
|---|---|---|
static class |
HtmlLayout.Builder |
|
static class |
HtmlLayout.FontSize |
Possible font sizes
|
AbstractStringLayout.Serializer, AbstractStringLayout.Serializer2| Modifier and Type | Field | Description |
|---|---|---|
static String |
DEFAULT_FONT_FAMILY |
Default font family: "arial,sans-serif".
|
configuration, eventCount, footer, header, LOGGERDEFAULT_STRING_BUILDER_SIZE, MAX_STRING_BUILDER_SIZEELEMENT_TYPE| Modifier and Type | Method | Description |
|---|---|---|
static HtmlLayout |
createDefaultLayout() |
Creates an HTML Layout using the default settings.
|
static HtmlLayout |
createLayout(boolean locationInfo,
String title,
String contentType,
Charset charset,
String fontSize,
String font) |
Creates an HTML Layout.
|
String |
getContentType() |
Returns the content type output by this layout.
|
byte[] |
getFooter() |
Returns the appropriate HTML footers.
|
byte[] |
getHeader() |
Returns appropriate HTML headers.
|
String |
getTitle() |
For testing purposes.
|
boolean |
isLocationInfo() |
For testing purposes.
|
static HtmlLayout.Builder |
newBuilder() |
|
String |
toSerializable(LogEvent event) |
Formats as a String.
|
encode, getConfiguration, getContentFormat, markEventgetBytes, getCharset, getFooterSerializer, getHeaderSerializer, getStringBuilder, getStringBuilderEncoder, serializeToBytes, serializeToString, toByteArray, trimToMaxSizegetContentFormatpublic static final String DEFAULT_FONT_FAMILY
public String getTitle()
public boolean isLocationInfo()
public String toSerializable(LogEvent event)
event - The Logging Event.public String getContentType()
LayoutgetContentType in interface Layout<String>getContentType in class AbstractStringLayoutpublic byte[] getHeader()
getHeader in interface Layout<String>getHeader in class AbstractStringLayoutpublic byte[] getFooter()
getFooter in interface Layout<String>getFooter in class AbstractStringLayout@PluginFactory public static HtmlLayout createLayout(@PluginAttribute("locationInfo") boolean locationInfo, @PluginAttribute(value="title",defaultString="Log4j Log Messages") String title, @PluginAttribute("contentType") String contentType, @PluginAttribute(value="charset",defaultString="UTF-8") Charset charset, @PluginAttribute("fontSize") String fontSize, @PluginAttribute(value="fontName",defaultString="arial,sans-serif") String font)
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.fontSize - The font size of the text.font - The font to use for the text.public static HtmlLayout createDefaultLayout()
@PluginBuilderFactory public static HtmlLayout.Builder newBuilder()
Copyright © 1999-2018. 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.