Package org.apache.log4j.layout
Class Log4j1XmlLayout
java.lang.Object
org.apache.logging.log4j.core.layout.AbstractLayout<String>
org.apache.logging.log4j.core.layout.AbstractStringLayout
org.apache.log4j.layout.Log4j1XmlLayout
- All Implemented Interfaces:
LocationAware
,Layout<String>
,Encoder<LogEvent>
,StringLayout
@Plugin(name="Log4j1XmlLayout",
category="Core",
elementType="layout",
printObject=true)
public final class Log4j1XmlLayout
extends AbstractStringLayout
Port of XMLLayout in Log4j 1.x. Provided for compatibility with existing Log4j 1 configurations.
Originally developed by Ceki Gülcü, Mathias Bogaert.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout
AbstractStringLayout.Builder<B extends AbstractStringLayout.Builder<B>>, AbstractStringLayout.Serializer, AbstractStringLayout.Serializer2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
We yield to the \r\n heresy.private final boolean
private final boolean
Fields inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout
DEFAULT_STRING_BUILDER_SIZE, MAX_STRING_BUILDER_SIZE
Fields inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
configuration, eventCount, footer, header, LOGGER
Fields inherited from interface org.apache.logging.log4j.core.Layout
ELEMENT_TYPE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Log4j1XmlLayout
createLayout
(boolean locationInfo, boolean properties) void
encode
(LogEvent event, ByteBufferDestination destination) Encodes the specified source LogEvent to some binary representation and writes the result to the specified destination.private void
formatTo
(LogEvent event, StringBuilder buf) boolean
boolean
toSerializable
(LogEvent event) Formats the event as an Object that can be serialized.Methods inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout
getBytes, getCharset, getContentType, getFooter, getFooterSerializer, getHeader, getHeaderSerializer, getStringBuilder, getStringBuilderEncoder, requiresLocation, serializeToBytes, serializeToString, toByteArray, trimToMaxSize
Methods inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
getConfiguration, getContentFormat, markEvent
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.logging.log4j.core.Layout
getContentFormat
-
Field Details
-
EOL
We yield to the \r\n heresy.- See Also:
-
locationInfo
private final boolean locationInfo -
properties
private final boolean properties
-
-
Constructor Details
-
Log4j1XmlLayout
private Log4j1XmlLayout(boolean locationInfo, boolean properties)
-
-
Method Details
-
createLayout
@PluginFactory public static Log4j1XmlLayout createLayout(@PluginAttribute("locationInfo") boolean locationInfo, @PluginAttribute("properties") boolean properties) -
isLocationInfo
public boolean isLocationInfo() -
isProperties
public boolean isProperties() -
encode
Description copied from class:AbstractLayout
Encodes the specified source LogEvent to some binary representation and writes the result to the specified destination.The default implementation of this method delegates to the
Layout.toByteArray(LogEvent)
method which allocates temporary objects.Subclasses can override this method to provide a garbage-free implementation. For text-based layouts,
AbstractStringLayout
provides various convenience methods to help with this:@Plugin(name = "MyLayout", category = Node.CATEGORY, elementType = Layout.ELEMENT_TYPE, printObject = true) public final class MyLayout extends AbstractStringLayout {
-
toSerializable
Description copied from interface:Layout
Formats the event as an Object that can be serialized.- Parameters:
event
- The Logging Event.- Returns:
- The formatted event.
-
formatTo
-