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
Fields inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout
DEFAULT_STRING_BUILDER_SIZE, MAX_STRING_BUILDER_SIZEFields inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
configuration, eventCount, footer, header, LOGGERFields inherited from interface org.apache.logging.log4j.core.Layout
ELEMENT_TYPE -
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.booleanbooleantoSerializable(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, trimToMaxSizeMethods inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
getConfiguration, getContentFormat, markEventMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.logging.log4j.core.Layout
getContentFormat
-
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
Description copied from interface:LayoutFormats the event as an Object that can be serialized.- Parameters:
event- The Logging Event.- Returns:
- The formatted event.
-