@Plugin(name="Log4j1XmlLayout", category="Core", elementType="layout", printObject=true) public final class Log4j1XmlLayout extends AbstractStringLayout
AbstractStringLayout.Builder<B extends AbstractStringLayout.Builder<B>>, AbstractStringLayout.Serializer, AbstractStringLayout.Serializer2
Modifier and Type | Field and Description |
---|---|
private boolean |
locationInfo |
private boolean |
properties |
DEFAULT_STRING_BUILDER_SIZE, MAX_STRING_BUILDER_SIZE
configuration, eventCount, footer, header, LOGGER
ELEMENT_TYPE
Modifier | Constructor and Description |
---|---|
private |
Log4j1XmlLayout(boolean locationInfo,
boolean properties) |
Modifier and Type | Method and 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.
|
private void |
formatTo(LogEvent event,
java.lang.StringBuilder buf) |
boolean |
isLocationInfo() |
boolean |
isProperties() |
java.lang.String |
toSerializable(LogEvent event)
Formats the event as an Object that can be serialized.
|
getBytes, getCharset, getContentType, getFooter, getFooterSerializer, getHeader, getHeaderSerializer, getStringBuilder, getStringBuilderEncoder, serializeToBytes, serializeToString, toByteArray, trimToMaxSize
getConfiguration, getContentFormat, markEvent
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getContentFormat
private final boolean locationInfo
private final boolean properties
private Log4j1XmlLayout(boolean locationInfo, boolean properties)
@PluginFactory public static Log4j1XmlLayout createLayout(@PluginAttribute(value="locationInfo") boolean locationInfo, @PluginAttribute(value="properties") boolean properties)
public boolean isLocationInfo()
public boolean isProperties()
public void encode(LogEvent event, ByteBufferDestination destination)
AbstractLayout
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 {
encode
in interface Encoder<LogEvent>
encode
in class AbstractLayout<java.lang.String>
event
- the LogEvent to encode.destination
- holds the ByteBuffer to write into.AbstractStringLayout.getStringBuilder()
,
AbstractStringLayout.getStringBuilderEncoder()
public java.lang.String toSerializable(LogEvent event)
Layout
event
- The Logging Event.private void formatTo(LogEvent event, java.lang.StringBuilder buf)