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_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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static 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.boolean
isLocationInfo()
boolean
isProperties()
String
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
-
-
-
-
Method Detail
-
createLayout
@PluginFactory public static Log4j1XmlLayout createLayout(@PluginAttribute("locationInfo") boolean locationInfo, @PluginAttribute("properties") boolean properties)
-
isLocationInfo
public boolean isLocationInfo()
-
isProperties
public boolean isProperties()
-
encode
public void encode(LogEvent event, ByteBufferDestination destination)
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 {
- Specified by:
encode
in interfaceEncoder<LogEvent>
- Overrides:
encode
in classAbstractLayout<String>
- Parameters:
event
- the LogEvent to encode.destination
- holds the ByteBuffer to write into.- See Also:
AbstractStringLayout.getStringBuilder()
,AbstractStringLayout.getStringBuilderEncoder()
-
-