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 AbstractStringLayout
AbstractStringLayout.Builder<B>, AbstractStringLayout.Serializer, AbstractStringLayout.Serializer2 -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringWe yield to the \r\n heresy.private final booleanprivate final booleanFields inherited from class AbstractStringLayout
DEFAULT_STRING_BUILDER_SIZE, MAX_STRING_BUILDER_SIZEFields inherited from class AbstractLayout
configuration, eventCount, footer, header, LOGGERFields inherited from interface Layout
ELEMENT_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Log4j1XmlLayoutcreateLayout(boolean locationInfo, boolean properties) voidencode(LogEvent event, ByteBufferDestination destination) Encodes the specified source LogEvent to some binary representation and writes the result to the specified destination.private voidformatTo(LogEvent event, StringBuilder buf) booleanbooleantoSerializable(LogEvent event) Formats the event as an Object that can be serialized.Methods inherited from class AbstractStringLayout
getBytes, getCharset, getContentType, getFooter, getFooterSerializer, getHeader, getHeaderSerializer, getStringBuilder, getStringBuilderEncoder, requiresLocation, serializeToBytes, serializeToString, toByteArray, trimToMaxSizeMethods inherited from class AbstractLayout
getConfiguration, getContentFormat, markEventMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Layout
getContentFormat
-
Field Details
-
EOL
-
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:AbstractLayoutEncodes 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,
AbstractStringLayoutprovides 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
-
formatTo
-