Plugin reference

This page is a Javadoc-on-steroids specialized for Log4j plugins. This reference manual is derived from the source code of all Log4j plugins and types associated with them. You can use this reference manual to precisely customize your log4j2.xml.

Every running Log4j system is a constellation of plugins, which is analogous to beans in Java EE and Spring. This not only allows Log4j itself to be developed in individual components, but also enables extensibility users can leverage.

Index

Below is a list of all types reachable by plugins grouped by the Maven coordinate of the artifact bundling them.

log4j-1.2-api

AppenderBuilder

Class

org.apache.log4j.builders.appender.AppenderBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Define an Appender Builder.

org.apache.log4j.AsyncAppender

Class

org.apache.log4j.builders.appender.AsyncAppenderBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build an Async Appender

XML snippet
<org.apache.log4j.AsyncAppender/>

org.apache.log4j.ConsoleAppender

Class

org.apache.log4j.builders.appender.ConsoleAppenderBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build a Console Appender

XML snippet
<org.apache.log4j.ConsoleAppender/>

org.apache.log4j.DailyRollingFileAppender

Class

org.apache.log4j.builders.appender.DailyRollingFileAppenderBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build a Daily Rolling File Appender

XML snippet
<org.apache.log4j.DailyRollingFileAppender/>

org.apache.log4j.rolling.RollingFileAppender

Class

org.apache.log4j.builders.appender.EnhancedRollingFileAppenderBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build a File Appender

XML snippet
<org.apache.log4j.rolling.RollingFileAppender/>

org.apache.log4j.FileAppender

Class

org.apache.log4j.builders.appender.FileAppenderBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build a File Appender

XML snippet
<org.apache.log4j.FileAppender/>

org.apache.log4j.varia.NullAppender

Class

org.apache.log4j.builders.appender.NullAppenderBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build a Null Appender

XML snippet
<org.apache.log4j.varia.NullAppender/>

org.apache.log4j.rewrite.RewriteAppender

Class

org.apache.log4j.builders.appender.RewriteAppenderBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build a Rewrite Appender

XML snippet
<org.apache.log4j.rewrite.RewriteAppender/>

org.apache.log4j.RollingFileAppender

Class

org.apache.log4j.builders.appender.RollingFileAppenderBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build a File Appender

XML snippet
<org.apache.log4j.RollingFileAppender/>

org.apache.log4j.net.SocketAppender

Class

org.apache.log4j.builders.appender.SocketAppenderBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build a Console Appender

XML snippet
<org.apache.log4j.net.SocketAppender/>

org.apache.log4j.net.SyslogAppender

Class

org.apache.log4j.builders.appender.SyslogAppenderBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build a File Appender

XML snippet
<org.apache.log4j.net.SyslogAppender/>

org.apache.log4j.varia.DenyAllFilter

Class

org.apache.log4j.builders.filter.DenyAllFilterBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build a Pattern Layout

XML snippet
<org.apache.log4j.varia.DenyAllFilter/>

FilterBuilder

Class

org.apache.log4j.builders.filter.FilterBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Define a Filter Builder.

org.apache.log4j.varia.LevelMatchFilter

Class

org.apache.log4j.builders.filter.LevelMatchFilterBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build a Level match filter.

XML snippet
<org.apache.log4j.varia.LevelMatchFilter/>

org.apache.log4j.varia.LevelRangeFilter

Class

org.apache.log4j.builders.filter.LevelRangeFilterBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build a Level range filter.

In this class, order of Level is log4j1 way, i.e., Level and Level have minimum and maximum order, respectively. (see: LOG4J2-2315)

XML snippet
<org.apache.log4j.varia.LevelRangeFilter/>

org.apache.log4j.varia.StringMatchFilter

Class

org.apache.log4j.builders.filter.StringMatchFilterBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build a String match filter.

XML snippet
<org.apache.log4j.varia.StringMatchFilter/>

org.apache.log4j.HTMLLayout

Class

org.apache.log4j.builders.layout.HtmlLayoutBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build a Pattern Layout

XML snippet
<org.apache.log4j.HTMLLayout/>

LayoutBuilder

Class

org.apache.log4j.builders.layout.LayoutBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Define a Layout Builder.

org.apache.log4j.PatternLayout

Class

org.apache.log4j.builders.layout.PatternLayoutBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build a Pattern Layout

XML snippet
<org.apache.log4j.PatternLayout/>

org.apache.log4j.SimpleLayout

Class

org.apache.log4j.builders.layout.SimpleLayoutBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build a Pattern Layout

XML snippet
<org.apache.log4j.SimpleLayout/>

org.apache.log4j.TTCCLayout

Class

org.apache.log4j.builders.layout.TTCCLayoutBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build a Pattern Layout

XML snippet
<org.apache.log4j.TTCCLayout/>

org.apache.log4j.xml.XMLLayout

Class

org.apache.log4j.builders.layout.XmlLayoutBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Build an XML Layout

XML snippet
<org.apache.log4j.xml.XMLLayout/>

org.apache.log4j.rolling.CompositeTriggeringPolicy

Class

org.apache.log4j.builders.rolling.CompositeTriggeringPolicyBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

XML snippet
<org.apache.log4j.rolling.CompositeTriggeringPolicy/>

org.apache.log4j.rolling.SizeBasedTriggeringPolicy

Class

org.apache.log4j.builders.rolling.SizeBasedTriggeringPolicyBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

XML snippet
<org.apache.log4j.rolling.SizeBasedTriggeringPolicy/>

org.apache.log4j.rolling.TimeBasedRollingPolicy

Class

org.apache.log4j.builders.rolling.TimeBasedRollingPolicyBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

XML snippet
<org.apache.log4j.rolling.TimeBasedRollingPolicy/>

TriggeringPolicyBuilder

Class

org.apache.log4j.builders.rolling.TriggeringPolicyBuilder

Provider

org.apache.logging.log4j:log4j-1.2-api

Log4j1PropertiesConfigurationFactory

Class

org.apache.log4j.config.PropertiesConfigurationFactory

Provider

org.apache.logging.log4j:log4j-1.2-api

Configures Log4j from a log4j 1 format properties file.

XML snippet
<Log4j1PropertiesConfigurationFactory/>

Log4j1SyslogLayout

Class

org.apache.log4j.layout.Log4j1SyslogLayout

Provider

org.apache.logging.log4j:log4j-1.2-api

Port of the layout used by SyslogAppender in Log4j 1.x.

Provided for compatibility with existing Log4j 1 configurations. Originally developed by Ceki Glc and Anders Kristensen.

XML snippet
<Log4j1SyslogLayout charset=""
                    facility=""
                    facilityPrinting=""
                    footer=""
                    header="">
    <a-Layout-implementation/>
    <a-Serializer-implementation/>
</Log4j1SyslogLayout>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

charset

Charset?

facility

Facility?

facilityPrinting

boolean?

footer

String?

header

String?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Layout?

Serializer?

Log4j1XmlLayout

Class

org.apache.log4j.layout.Log4j1XmlLayout

Provider

org.apache.logging.log4j:log4j-1.2-api

Port of XMLLayout in Log4j 1.x.

Provided for compatibility with existing Log4j 1 configurations. Originally developed by Ceki Glc, Mathias Bogaert.

XML snippet
<Log4j1XmlLayout locationInfo=""
                 properties=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

locationInfo

boolean?

properties

boolean?

Log4j1LevelPatternConverter

Class

org.apache.log4j.pattern.Log4j1LevelPatternConverter

Provider

org.apache.logging.log4j:log4j-1.2-api

Outputs the Log4j 1.x level name.

XML snippet
<Log4j1LevelPatternConverter/>

Log4j1MdcPatternConverter

Class

org.apache.log4j.pattern.Log4j1MdcPatternConverter

Provider

org.apache.logging.log4j:log4j-1.2-api

Able to handle the contents of the LogEvent’s MDC and either output the entire contents of the properties, or to output the value of a specific key within the property bundle when this pattern converter has the option set.

XML snippet
<Log4j1MdcPatternConverter/>

Log4j1NdcPatternConverter

Class

org.apache.log4j.pattern.Log4j1NdcPatternConverter

Provider

org.apache.logging.log4j:log4j-1.2-api

Returns the event’s NDC in a StringBuilder.

XML snippet
<Log4j1NdcPatternConverter/>

Log4j1XmlConfigurationFactory

Class

org.apache.log4j.xml.XmlConfigurationFactory

Provider

org.apache.logging.log4j:log4j-1.2-api

Constructs a Configuration usable in Log4j 2 from a Log4j 1 configuration file.

XML snippet
<Log4j1XmlConfigurationFactory/>

log4j-cassandra

Type

Class

com.datastax.driver.core.BatchStatement.Type

Provider

org.apache.logging.log4j:log4j-cassandra

Cassandra

Class

org.apache.logging.log4j.cassandra.CassandraAppender

Provider

org.apache.logging.log4j:log4j-cassandra

Appender plugin that uses a Cassandra database.

XML snippet
<Cassandra batched=""
           batchType=""
           bufferSize=""
           clusterName=""
           ignoreExceptions=""
           keyspace=""
           name=""
           password=""
           table=""
           useClockForTimestampGenerator=""
           username=""
           useTls="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <ColumnMapping/><!-- multiple occurrences allowed -->
    <Property/><!-- multiple occurrences allowed -->
    <SocketAddress/><!-- multiple occurrences allowed -->
</Cassandra>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

batched

boolean?

Whether or not to use batch statements when inserting records.

batchType

Type?

If batch statements are enabled, use this type of batch statement.

bufferSize

int?

Number of LogEvents to buffer before writing.

Can be used with or without batch statements.

clusterName

String

ignoreExceptions

boolean?

keyspace

String

name

String

password

String?

table

String

useClockForTimestampGenerator

boolean?

Override the default TimestampGenerator with one based on the configured org.apache.logging.log4j.core.util.Clock.

username

String?

useTls

boolean?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

ColumnMapping

ColumnMapping

List of column mappings to convert a LogEvent into a database row.

Property

Property?

Filter?

Layout?

SocketAddress

SocketAddress

List of Cassandra node contact points.

Addresses without a port (or port set to 0) will use the default Cassandra port (9042).

log4j-core

SpinPolicy

Class

com.conversantmedia.util.concurrent.SpinPolicy

Provider

org.apache.logging.log4j:log4j-core

QuoteMode

Class

org.apache.commons.csv.QuoteMode

Provider

org.apache.logging.log4j:log4j-core

Level

Class

org.apache.logging.log4j.Level

Provider

org.apache.logging.log4j:log4j-core

Represents a logging level. NOTE: The Log4j API supports custom levels, the following list contains only the standard ones.

Appender

Class

org.apache.logging.log4j.core.Appender

Provider

org.apache.logging.log4j:log4j-core

Appends org.apache.logging.log4j.core.LogEvents.

An Appender can contain a Layout if applicable as well as an org.apache.logging.log4j.core.ErrorHandler. Typical Appender implementations coordinate with an implementation of org.apache.logging.log4j.core.appender.AbstractManager to handle external resources such as streams, connections, and other shared state. As Appenders are plugins, concrete implementations need to be annotated with org.apache.logging.log4j.core.config.plugins.Plugin and need to provide a static factory method annotated with org.apache.logging.log4j.core.config.plugins.PluginFactory.

Most core plugins are written using a related Manager class that handle the actual task of serializing a org.apache.logging.log4j.core.LogEvent to some output location. For instance, many Appenders can take advantage of the org.apache.logging.log4j.core.appender.OutputStreamManager class.

It is recommended that Appenders don’t do any heavy lifting since there can be many instances of the class being used at any given time. When resources require locking (e.g., through org.apache.logging.log4j.core.java.nio.channels.FileLock), it is important to isolate synchronized code to prevent concurrency issues.

Filter

Class

org.apache.logging.log4j.core.Filter

Provider

org.apache.logging.log4j:log4j-core

Interface that must be implemented to allow custom event filtering.

It is highly recommended that applications make use of the Filters provided with this implementation before creating their own.

This interface supports "global" filters (i.e. - all events must pass through them first), attached to specific loggers and associated with Appenders. It is recommended that, where possible, Filter implementations create a generic filtering method that can be called from any of the filter methods.

Result

Class

org.apache.logging.log4j.core.Filter.Result

Provider

org.apache.logging.log4j:log4j-core

The result that can returned from a filter method call.

Layout

Class

org.apache.logging.log4j.core.Layout

Provider

org.apache.logging.log4j:log4j-core

Lays out a org.apache.logging.log4j.core.LogEvent in different formats.

The formats are:

  • byte[]

  • an implementer of java.io.Serializable, like byte[]

  • java.lang.String

  • org.apache.logging.log4j.core.LogEvent

Since 2.6, Layouts can encode a LogEvent directly to a org.apache.logging.log4j.core.layout.ByteBufferDestination without creating temporary intermediary objects.

LifeCycle

Class

org.apache.logging.log4j.core.LifeCycle

Provider

org.apache.logging.log4j:log4j-core

All proper Java frameworks implement some sort of object life cycle.

In Log4j, the main interface for handling the life cycle context of an object is this one. An object first starts in the org.apache.logging.log4j.core.State#INITIALIZED state by default to indicate the class has been loaded. From here, calling the LifeCycle method will change this state to org.apache.logging.log4j.core.State#STARTING. After successfully being started, this state is changed to org.apache.logging.log4j.core.State#STARTED. When the LifeCycle is called, this goes into the org.apache.logging.log4j.core.State#STOPPING state. After successfully being stopped, this goes into the org.apache.logging.log4j.core.State#STOPPED state. In most circumstances, implementation classes should store their org.apache.logging.log4j.core.State in a volatile field or inside an org.apache.logging.log4j.core.java.util.concurrent.atomic.AtomicReference dependent on synchronization and concurrency requirements.

StringLayout

Class

org.apache.logging.log4j.core.StringLayout

Provider

org.apache.logging.log4j:log4j-core

Instantiates the Layout type for String-based layouts.

AbstractAppender

Class

org.apache.logging.log4j.core.appender.AbstractAppender

Provider

org.apache.logging.log4j:log4j-core

Abstract base class for Appenders.

Although Appenders do not have to extend this class, doing so will simplify their implementation.

AbstractOutputStreamAppender

Class

org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender

Provider

org.apache.logging.log4j:log4j-core

Appends log events as bytes to a byte output stream.

The stream encoding is defined in the layout.

AbstractWriterAppender

Class

org.apache.logging.log4j.core.appender.AbstractWriterAppender

Provider

org.apache.logging.log4j:log4j-core

Appends log events as strings to a writer.

Known implementations

AppenderSet

Class

org.apache.logging.log4j.core.appender.AppenderSet

Provider

org.apache.logging.log4j:log4j-core

A deferred plugin for appenders.

XML snippet
<AppenderSet/>

Async

Class

org.apache.logging.log4j.core.appender.AsyncAppender

Provider

org.apache.logging.log4j:log4j-core

Appends to one or more Appenders asynchronously.

You can configure an AsyncAppender with one or more Appenders and an Appender to append to if the queue is full. The AsyncAppender does not allow a filter to be specified on the Appender references.

XML snippet
<Async blocking=""
       bufferSize=""
       errorRef=""
       ignoreExceptions=""
       includeLocation=""
       name=""
       shutdownTimeout="">
    <a-Filter-implementation/>
    <a-BlockingQueueFactory-implementation/>
    <AppenderRef/><!-- multiple occurrences allowed -->
    <Property/><!-- multiple occurrences allowed -->
</Async>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

blocking

boolean?

bufferSize

int?

errorRef

String?

ignoreExceptions

boolean?

includeLocation

boolean?

name

String

shutdownTimeout

long?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

BlockingQueueFactory?

AppenderRef

AppenderRef

Property

Property?

Filter?

Console

Class

org.apache.logging.log4j.core.appender.ConsoleAppender

Provider

org.apache.logging.log4j:log4j-core

Appends log events to System. out or System. err using a layout specified by the user.

The default target is System. out.

TODO Accessing System. out or System. err as a byte stream instead of a writer bypasses the JVM’s knowledge of the proper encoding. (RG) Encoding is handled within the Layout. Typically, a Layout will generate a String and then call getBytes which may use a configured encoding or the system default. OTOH, a Writer cannot print byte streams.

XML snippet
<Console bufferedIo=""
         bufferSize=""
         direct=""
         follow=""
         ignoreExceptions=""
         immediateFlush=""
         name=""
         target="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <Property/><!-- multiple occurrences allowed -->
</Console>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

bufferedIo

boolean?

bufferSize

int?

direct

boolean?

follow

boolean?

ignoreExceptions

boolean?

immediateFlush

boolean?

name

String

target

Target

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

Filter?

Layout?

Target

Class

org.apache.logging.log4j.core.appender.ConsoleAppender.Target

Provider

org.apache.logging.log4j:log4j-core

Enumeration of console destinations.

CountingNoOp

Class

org.apache.logging.log4j.core.appender.CountingNoOpAppender

Provider

org.apache.logging.log4j:log4j-core

No-Operation Appender that counts events.

XML snippet
<CountingNoOp name=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

name

String?

Failover

Class

org.apache.logging.log4j.core.appender.FailoverAppender

Provider

org.apache.logging.log4j:log4j-core

The FailoverAppender will capture exceptions in an Appender and then route the event to a different appender.

Hopefully it is obvious that the Appenders must be configured to not suppress exceptions for the FailoverAppender to work.

XML snippet
<Failover ignoreExceptions=""
          name=""
          primary=""
          retryIntervalSeconds="">
    <a-String-implementation/><!-- multiple occurrences allowed -->
    <a-Filter-implementation/>
</Failover>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

ignoreExceptions

String?

If "true" (default) exceptions encountered when appending events are logged; otherwise they are propagated to the caller.

name

String?

The name of the Appender (required).

primary

String?

The name of the primary Appender (required).

retryIntervalSeconds

String?

The retry interval in seconds.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

String?

The name of one or more Appenders to fail over to (at least one is required).

Filter?

A Filter (optional).

Failovers

Class

org.apache.logging.log4j.core.appender.FailoversPlugin

Provider

org.apache.logging.log4j:log4j-core

The array of failover Appenders.

XML snippet
<Failovers/>
Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

AppenderRef

AppenderRef?

The references to return.

File

Class

org.apache.logging.log4j.core.appender.FileAppender

Provider

org.apache.logging.log4j:log4j-core

File Appender.

XML snippet
<File advertise=""
      advertiseUri=""
      append=""
      bufferedIo=""
      bufferSize=""
      createOnDemand=""
      fileGroup=""
      fileName=""
      fileOwner=""
      filePermissions=""
      ignoreExceptions=""
      immediateFlush=""
      locking=""
      name="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <Property/><!-- multiple occurrences allowed -->
</File>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

advertise

boolean?

advertiseUri

String?

append

boolean?

bufferedIo

boolean?

bufferSize

int?

createOnDemand

boolean?

fileGroup

String?

fileName

String

fileOwner

String?

filePermissions

String?

ignoreExceptions

boolean?

immediateFlush

boolean?

locking

boolean?

name

String

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

Filter?

Layout?

Http

Class

org.apache.logging.log4j.core.appender.HttpAppender

Provider

org.apache.logging.log4j:log4j-core

Sends log events over HTTP.

XML snippet
<Http connectTimeoutMillis=""
      ignoreExceptions=""
      method=""
      name=""
      readTimeoutMillis=""
      url=""
      verifyHostname="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <Property/><!-- multiple occurrences allowed -->
    <Ssl/>
</Http>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

connectTimeoutMillis

int?

ignoreExceptions

boolean?

method

String?

name

String

readTimeoutMillis

int?

url

URL

verifyHostname

boolean?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

Filter?

Layout?

Ssl

SslConfiguration?

MemoryMappedFile

Class

org.apache.logging.log4j.core.appender.MemoryMappedFileAppender

Provider

org.apache.logging.log4j:log4j-core

Memory Mapped File Appender.

XML snippet
<MemoryMappedFile advertise=""
                  advertiseURI=""
                  append=""
                  bufferedIo=""
                  bufferSize=""
                  fileName=""
                  ignoreExceptions=""
                  immediateFlush=""
                  name=""
                  regionLength="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <Property/><!-- multiple occurrences allowed -->
</MemoryMappedFile>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

advertise

boolean?

advertiseURI

String?

append

boolean?

bufferedIo

boolean?

bufferSize

int?

fileName

String?

ignoreExceptions

boolean?

immediateFlush

boolean?

name

String

regionLength

int?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

Filter?

Layout?

Null

Class

org.apache.logging.log4j.core.appender.NullAppender

Provider

org.apache.logging.log4j:log4j-core

An Appender that ignores log events.

Use for compatibility with version 1.2 and handy for composing a ScriptAppenderSelector.

XML snippet
<Null name=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

name

String?

OutputStream

Class

org.apache.logging.log4j.core.appender.OutputStreamAppender

Provider

org.apache.logging.log4j:log4j-core

Appends log events to a given output stream using a layout.

Character encoding is handled within the Layout.

XML snippet
<OutputStream bufferedIo=""
              bufferSize=""
              ignoreExceptions=""
              immediateFlush=""
              name="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <Property/><!-- multiple occurrences allowed -->
</OutputStream>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

bufferedIo

boolean?

bufferSize

int?

ignoreExceptions

boolean?

immediateFlush

boolean?

name

String

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

Filter?

Layout?

RandomAccessFile

Class

org.apache.logging.log4j.core.appender.RandomAccessFileAppender

Provider

org.apache.logging.log4j:log4j-core

File Appender.

XML snippet
<RandomAccessFile advertise=""
                  advertiseURI=""
                  append=""
                  bufferedIo=""
                  bufferSize=""
                  fileName=""
                  ignoreExceptions=""
                  immediateFlush=""
                  name="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <Property/><!-- multiple occurrences allowed -->
</RandomAccessFile>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

advertise

boolean?

advertiseURI

String?

append

boolean?

bufferedIo

boolean?

bufferSize

int?

fileName

String?

ignoreExceptions

boolean?

immediateFlush

boolean?

name

String

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

Filter?

Layout?

RollingFile

Class

org.apache.logging.log4j.core.appender.RollingFileAppender

Provider

org.apache.logging.log4j:log4j-core

An appender that writes to files and can roll over at intervals.

XML snippet
<RollingFile advertise=""
             advertiseUri=""
             append=""
             bufferedIo=""
             bufferSize=""
             createOnDemand=""
             fileGroup=""
             fileName=""
             fileOwner=""
             filePattern=""
             filePermissions=""
             ignoreExceptions=""
             immediateFlush=""
             locking=""
             name="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <a-RolloverStrategy-implementation/>
    <a-TriggeringPolicy-implementation/>
    <Property/><!-- multiple occurrences allowed -->
</RollingFile>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

advertise

boolean?

advertiseUri

String?

append

boolean?

bufferedIo

boolean?

bufferSize

int?

createOnDemand

boolean?

fileGroup

String?

fileName

String?

fileOwner

String?

filePattern

String

filePermissions

String?

ignoreExceptions

boolean?

immediateFlush

boolean?

locking

boolean?

name

String

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

RolloverStrategy?

TriggeringPolicy

Property

Property?

Filter?

Layout?

RollingRandomAccessFile

Class

org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender

Provider

org.apache.logging.log4j:log4j-core

An appender that writes to random access files and can roll over at intervals.

XML snippet
<RollingRandomAccessFile advertise=""
                         advertiseURI=""
                         append=""
                         bufferedIo=""
                         bufferSize=""
                         fileGroup=""
                         fileName=""
                         fileOwner=""
                         filePattern=""
                         filePermissions=""
                         ignoreExceptions=""
                         immediateFlush=""
                         name="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <a-RolloverStrategy-implementation/>
    <a-TriggeringPolicy-implementation/>
    <Property/><!-- multiple occurrences allowed -->
</RollingRandomAccessFile>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

advertise

boolean?

advertiseURI

String?

append

boolean?

bufferedIo

boolean?

bufferSize

int?

fileGroup

String?

fileName

String?

fileOwner

String?

filePattern

String?

filePermissions

String?

ignoreExceptions

boolean?

immediateFlush

boolean?

name

String

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

RolloverStrategy?

TriggeringPolicy?

Property

Property?

Filter?

Layout?

ScriptAppenderSelector

Class

org.apache.logging.log4j.core.appender.ScriptAppenderSelector

Provider

org.apache.logging.log4j:log4j-core

XML snippet
<ScriptAppenderSelector name="">
    <AppenderSet/>
    <a-AbstractScript-implementation/>
</ScriptAppenderSelector>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

name

String

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

AppenderSet

AppenderSet

AbstractScript

SMTP

Class

org.apache.logging.log4j.core.appender.SmtpAppender

Provider

org.apache.logging.log4j:log4j-core

Send an e-mail when a specific logging event occurs, typically on errors or fatal errors.

The number of logging events delivered in this e-mail depend on the value of BufferSize option. The SmtpAppender keeps only the last BufferSize logging events in its cyclic buffer. This keeps memory requirements at a reasonable level while still delivering useful application context. By default, an email message will formatted as HTML. This can be modified by setting a layout for the appender. By default, an email message will be sent when an ERROR or higher severity message is appended. This can be modified by setting a filter for the appender.

XML snippet
<SMTP bcc=""
      bufferSize=""
      cc=""
      from=""
      ignoreExceptions=""
      name=""
      replyTo=""
      smtpDebug=""
      smtpHost=""
      smtpPassword=""
      smtpPort=""
      smtpProtocol=""
      smtpUsername=""
      subject=""
      to="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <Property/><!-- multiple occurrences allowed -->
    <Ssl/>
</SMTP>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

bcc

String?

Comma-separated list of BCC email addresses.

bufferSize

int?

Number of log events to buffer before sending an email.

Defaults to .

cc

String?

Comma-separated list of CC email addresses.

from

String?

Email address of the sender.

ignoreExceptions

boolean?

name

String

replyTo

String?

Comma-separated list of Reply-To email addresses.

smtpDebug

boolean?

Enables or disables mail session debugging on STDOUT.

Disabled by default.

smtpHost

String?

Host name of SMTP server to send messages through.

smtpPassword

String?

Password to authenticate with SMTP server.

smtpPort

int?

Port number of SMTP server to send messages through.

smtpProtocol

String?

Transport protocol to use for SMTP such as "smtp" or "smtps".

Defaults to "smtp".

smtpUsername

String?

Username to authenticate with SMTP server.

subject

String?

Subject template for the email messages.

to

String?

Comma-separated list of recipient email addresses.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

Filter?

Specifies the filter used for this appender.

By default, uses a ThresholdFilter with a level of ERROR.

Layout?

Specifies the layout used for the email message body.

By default, this uses the default HTML layout.

Ssl

SslConfiguration?

Specifies an SSL configuration for smtps connections.

Socket

Class

org.apache.logging.log4j.core.appender.SocketAppender

Provider

org.apache.logging.log4j:log4j-core

An Appender that delivers events over socket connections.

Supports both TCP and UDP.

XML snippet
<Socket advertise=""
        bufferedIo=""
        bufferSize=""
        connectTimeoutMillis=""
        host=""
        ignoreExceptions=""
        immediateFail=""
        immediateFlush=""
        name=""
        port=""
        protocol=""
        reconnectDelayMillis="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <Property/><!-- multiple occurrences allowed -->
    <SocketOptions/>
    <Ssl/>
</Socket>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

advertise

boolean?

bufferedIo

boolean?

bufferSize

int?

connectTimeoutMillis

int?

host

String?

ignoreExceptions

boolean?

immediateFail

boolean?

immediateFlush

boolean?

name

String

port

int?

protocol

Protocol?

reconnectDelayMillis

int?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

Filter?

Layout?

SocketOptions

SocketOptions?

Ssl

SslConfiguration?

Known implementations

Syslog

Class

org.apache.logging.log4j.core.appender.SyslogAppender

Provider

org.apache.logging.log4j:log4j-core

The Syslog Appender.

XML snippet
<Syslog advertise=""
        appName=""
        bufferedIo=""
        bufferSize=""
        charset=""
        connectTimeoutMillis=""
        enterpriseNumber=""
        eventPrefix=""
        exceptionPattern=""
        facility=""
        format=""
        host=""
        id=""
        ignoreExceptions=""
        immediateFail=""
        immediateFlush=""
        includeMdc=""
        mdcExcludes=""
        mdcId=""
        mdcIncludes=""
        mdcPrefix=""
        mdcRequired=""
        messageId=""
        name=""
        newLine=""
        newLineEscape=""
        port=""
        protocol=""
        reconnectDelayMillis="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <Property/><!-- multiple occurrences allowed -->
    <LoggerFields/><!-- multiple occurrences allowed -->
    <SocketOptions/>
    <Ssl/>
</Syslog>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

advertise

boolean?

appName

String?

bufferedIo

boolean?

bufferSize

int?

charset

Charset?

connectTimeoutMillis

int?

enterpriseNumber

String?

eventPrefix

String?

exceptionPattern

String?

facility

Facility?

format

String?

host

String?

id

String?

ignoreExceptions

boolean?

immediateFail

boolean?

immediateFlush

boolean?

includeMdc

boolean?

mdcExcludes

String?

mdcId

String?

mdcIncludes

String?

mdcPrefix

String?

mdcRequired

String?

messageId

String?

name

String

newLine

boolean?

newLineEscape

String?

port

int?

protocol

Protocol?

reconnectDelayMillis

int?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

Filter?

Layout?

LoggerFields

LoggerFields?

SocketOptions

SocketOptions?

Ssl

SslConfiguration?

Writer

Class

org.apache.logging.log4j.core.appender.WriterAppender

Provider

org.apache.logging.log4j:log4j-core

Appends log events to a java.io.Writer.

XML snippet
<Writer ignoreExceptions=""
        name="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <Property/><!-- multiple occurrences allowed -->
</Writer>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

ignoreExceptions

boolean?

name

String

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

Filter?

Layout?

AbstractDatabaseAppender

Class

org.apache.logging.log4j.core.appender.db.AbstractDatabaseAppender

Provider

org.apache.logging.log4j:log4j-core

An abstract Appender for writing events to a database of some type, be it relational or NoSQL.

All database appenders should inherit from this base appender.

ColumnMapping

Class

org.apache.logging.log4j.core.appender.db.ColumnMapping

Provider

org.apache.logging.log4j:log4j-core

A configuration element for specifying a database column name mapping.

XML snippet
<ColumnMapping columnType=""
               literal=""
               name=""
               parameter=""
               pattern=""
               source=""
               type="">
    <a-StringLayout-implementation/>
</ColumnMapping>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

columnType

Class

Class to convert value to before storing in database.

If the type is compatible with org.apache.logging.log4j.spi.ThreadContextMap or org.apache.logging.log4j.util.ReadOnlyStringMap, then the MDC will be used. If the type is compatible with org.apache.logging.log4j.spi.ThreadContextStack, then the NDC will be used. If the type is compatible with java.util.Date, then the event timestamp will be used.

literal

String?

Literal value to use for populating a column.

This is generally useful for functions, stored procedures, etc. No escaping will be done on this value.

name

String

Column name.

parameter

String?

Parameter value to use for populating a column, MUST contain a single parameter marker '?'.

This is generally useful for functions, stored procedures, etc. No escaping will be done on this value.

pattern

String?

Pattern to use as a PatternLayout.

Convenient shorthand for ColumnMapping with a PatternLayout.

source

String?

Source name.

Useful when combined with a org.apache.logging.log4j.core.appender.db.org.apache.logging.log4j.message.MapMessage depending on the appender.

type

Class?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

StringLayout?

Layout of value to write to database (before type conversion).

Not applicable if ColumnMapping is a org.apache.logging.log4j.util.ReadOnlyStringMap, org.apache.logging.log4j.spi.ThreadContextMap, or org.apache.logging.log4j.spi.ThreadContextStack.

AbstractConnectionSource

Class

org.apache.logging.log4j.core.appender.db.jdbc.AbstractConnectionSource

Provider

org.apache.logging.log4j:log4j-core

AbstractDriverManagerConnectionSource

Class

org.apache.logging.log4j.core.appender.db.jdbc.AbstractDriverManagerConnectionSource

Provider

org.apache.logging.log4j:log4j-core

A ConnectionSource that uses a JDBC connection string, a user name, and a password to call java.sql.DriverManager#getConnection(String,String,String).

This plugin does not provide any connection pooling unless it is available through the connection string and driver itself. This handy to get you off the ground without having to deal with JNDI.

Column

Class

org.apache.logging.log4j.core.appender.db.jdbc.ColumnConfig

Provider

org.apache.logging.log4j:log4j-core

A configuration element used to configure which event properties are logged to which columns in the database table.

XML snippet
<Column isClob=""
        isEventTimestamp=""
        isUnicode=""
        literal=""
        name=""
        pattern=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

isClob

boolean?

isEventTimestamp

boolean?

isUnicode

boolean?

literal

String?

The literal value to insert into the column as-is without any quoting or escaping.

Mutually exclusive with pattern! =null and eventTimestamp=true.

name

String

The name of the database column as it exists within the database table.

pattern

String?

The PatternLayout pattern to insert in this column.

Mutually exclusive with literal! =null and eventTimestamp=true

ConnectionSource

Class

org.apache.logging.log4j.core.appender.db.jdbc.ConnectionSource

Provider

org.apache.logging.log4j:log4j-core

Configuration element for JdbcAppender.

If you want to use the JdbcAppender but none of the provided connection sources meet your needs, you can simply create your own connection source.

DataSource

Class

org.apache.logging.log4j.core.appender.db.jdbc.DataSourceConnectionSource

Provider

org.apache.logging.log4j:log4j-core

A JdbcAppender connection source that uses a javax.sql.DataSource to connect to the database.

XML snippet
<DataSource jndiName=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

jndiName

String?

The full JNDI path where the data source is bound. Must start with java:/comp/env or environment-equivalent.

DriverManager

Class

org.apache.logging.log4j.core.appender.db.jdbc.DriverManagerConnectionSource

Provider

org.apache.logging.log4j:log4j-core

A ConnectionSource that uses a JDBC connection string, a user name, and a password to call java.sql.DriverManager#getConnection(String,String,String).

This plugin does not provide any connection pooling unless it is available through the connection string and driver itself. This handy to get you off the ground without having to deal with JNDI.

XML snippet
<DriverManager connectionString=""
               driverClassName=""
               password=""
               userName="">
    <Property/><!-- multiple occurrences allowed -->
</DriverManager>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

connectionString

String

driverClassName

String?

password

String?

userName

String?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

ConnectionFactory

Class

org.apache.logging.log4j.core.appender.db.jdbc.FactoryMethodConnectionSource

Provider

org.apache.logging.log4j:log4j-core

A JdbcAppender connection source that uses a public static factory method to obtain a java.sql.Connection or javax.sql.DataSource.

XML snippet
<ConnectionFactory class=""
                   method=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

class

String?

The name of a public class that contains a static method capable of returning either a javax.sql.DataSource or a java.sql.Connection.

method

String?

The name of the public static method on the aforementioned class that returns the data source or connection. If this method returns a java.sql.Connection, it should return a new connection every call.

JDBC

Class

org.apache.logging.log4j.core.appender.db.jdbc.JdbcAppender

Provider

org.apache.logging.log4j:log4j-core

This Appender writes logging events to a relational database using standard JDBC mechanisms.

It takes a list of ColumnConfigs and/or ColumnMappings with which it determines how to save the event data into the appropriate columns in the table. ColumnMapping is new as of Log4j 2.8 and supports type conversion and persistence using java.sql.PreparedStatement#setObject(int,Object). A ConnectionSource plugin instance instructs the appender (and org.apache.logging.log4j.core.appender.db.jdbc.JdbcDatabaseManager) how to connect to the database. This appender can be reconfigured at run time.

XML snippet
<JDBC bufferSize=""
      ignoreExceptions=""
      immediateFail=""
      name=""
      reconnectIntervalMillis=""
      tableName=""
      truncateStrings="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <ColumnMapping/><!-- multiple occurrences allowed -->
    <Column/><!-- multiple occurrences allowed -->
    <a-ConnectionSource-implementation/>
    <Property/><!-- multiple occurrences allowed -->
</JDBC>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

bufferSize

int?

If an integer greater than 0, this causes the appender to buffer log events and flush whenever the buffer reaches this size.

ignoreExceptions

boolean?

immediateFail

boolean?

name

String

reconnectIntervalMillis

long?

tableName

String

The name of the database table to insert log events into.

truncateStrings

boolean?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

ColumnMapping

ColumnMapping?

Column

ColumnConfig?

Information about the columns that log event data should be inserted into and how to insert that data.

ConnectionSource

The connections source from which database connections should be retrieved.

Property

Property?

Filter?

Layout?

JMS

Class

org.apache.logging.log4j.core.appender.mom.JmsAppender

Provider

org.apache.logging.log4j:log4j-core

Generic JMS Appender plugin for both queues and topics.

This Appender replaces the previous split ones. However, configurations set up for the 2.0 version of the JMS appenders will still work.

XML snippet
<JMS destinationBindingName=""
     factoryBindingName=""
     factoryName=""
     ignoreExceptions=""
     immediateFail=""
     name=""
     password=""
     providerUrl=""
     reconnectIntervalMillis=""
     securityCredentials=""
     securityPrincipalName=""
     urlPkgPrefixes=""
     userName="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <Property/><!-- multiple occurrences allowed -->
</JMS>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

destinationBindingName

String

factoryBindingName

String

factoryName

String?

ignoreExceptions

boolean?

immediateFail

boolean?

name

String

password

String?

providerUrl

String?

reconnectIntervalMillis

long?

securityCredentials

String?

securityPrincipalName

String?

urlPkgPrefixes

String?

userName

String?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

Filter?

Layout?

JeroMQ

Class

org.apache.logging.log4j.core.appender.mom.jeromq.JeroMqAppender

Provider

org.apache.logging.log4j:log4j-core

Sends log events to one or more ZeroMQ (JeroMQ) endpoints.

Requires the JeroMQ jar (LGPL as of 0.3.5)

XML snippet
<JeroMQ affinity=""
        backlog=""
        delayAttachOnConnect=""
        identity=""
        ignoreExceptions=""
        ipv4Only=""
        linger=""
        maxMsgSize=""
        name=""
        rcvHwm=""
        receiveBufferSize=""
        receiveTimeOut=""
        reconnectIVL=""
        reconnectIVLMax=""
        sendBufferSize=""
        sendTimeOut=""
        sndHwm=""
        tcpKeepAlive=""
        tcpKeepAliveCount=""
        tcpKeepAliveIdle=""
        tcpKeepAliveInterval=""
        xpubVerbose="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <Property/><!-- multiple occurrences allowed -->
</JeroMQ>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

affinity

long?

backlog

long?

delayAttachOnConnect

boolean?

identity

String?

ignoreExceptions

boolean?

ipv4Only

boolean?

linger

long?

maxMsgSize

long?

name

String

rcvHwm

long?

receiveBufferSize

long?

receiveTimeOut

int?

reconnectIVL

long?

reconnectIVLMax

long?

sendBufferSize

long?

sendTimeOut

int?

sndHwm

long?

tcpKeepAlive

int?

tcpKeepAliveCount

long?

tcpKeepAliveIdle

long?

tcpKeepAliveInterval

long?

xpubVerbose

boolean?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

Filter?

Layout?

Kafka

Class

org.apache.logging.log4j.core.appender.mom.kafka.KafkaAppender

Provider

org.apache.logging.log4j:log4j-core

Sends log events to an Apache Kafka topic.

XML snippet
<Kafka ignoreExceptions=""
       key=""
       name=""
       retryCount=""
       sendEventTimestamp=""
       syncSend=""
       topic="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <Property/><!-- multiple occurrences allowed -->
</Kafka>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

ignoreExceptions

boolean?

key

String?

name

String

retryCount

int?

sendEventTimestamp

boolean?

syncSend

boolean?

topic

String?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

Filter?

Layout?

NoSql

Class

org.apache.logging.log4j.core.appender.nosql.NoSqlAppender

Provider

org.apache.logging.log4j:log4j-core

This Appender writes logging events to a NoSQL database using a configured NoSQL provider.

It requires implementations of org.apache.logging.log4j.core.appender.nosql.NoSqlObject, org.apache.logging.log4j.core.appender.nosql.NoSqlConnection, and NoSqlProvider to "know" how to write events to the chosen NoSQL database.

For examples on how to write your own NoSQL provider, see the simple source code for the MongoDB and CouchDB providers.

XML snippet
<NoSql bufferSize=""
       ignoreExceptions=""
       name="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <a-NoSqlProvider-implementation/>
    <Property/><!-- multiple occurrences allowed -->
    <KeyValuePair/><!-- multiple occurrences allowed -->
</NoSql>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

bufferSize

int?

Sets the buffer size.

ignoreExceptions

boolean?

name

String

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

NoSqlProvider?

Sets the provider.

Property

Property?

Filter?

Layout?

KeyValuePair

KeyValuePair?

LoggerNameLevelRewritePolicy

Class

org.apache.logging.log4j.core.appender.rewrite.LoggerNameLevelRewritePolicy

Provider

org.apache.logging.log4j:log4j-core

Rewrites log event levels for a given logger name.

XML snippet
<LoggerNameLevelRewritePolicy logger="">
    <KeyValuePair/><!-- multiple occurrences allowed -->
</LoggerNameLevelRewritePolicy>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

logger

String?

The logger name prefix for events to rewrite; all event logger names that start with this string will be rewritten.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

KeyValuePair

KeyValuePair?

The levels to rewrite, the key is the source level, the value the target level.

MapRewritePolicy

Class

org.apache.logging.log4j.core.appender.rewrite.MapRewritePolicy

Provider

org.apache.logging.log4j:log4j-core

This policy modifies events by replacing or possibly adding keys and values to the MapMessage.

XML snippet
<MapRewritePolicy mode="">
    <KeyValuePair/><!-- multiple occurrences allowed -->
</MapRewritePolicy>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

mode

String?

The string representation of the Mode.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

KeyValuePair

KeyValuePair?

key/value pairs for the new Map keys and values.

PropertiesRewritePolicy

Class

org.apache.logging.log4j.core.appender.rewrite.PropertiesRewritePolicy

Provider

org.apache.logging.log4j:log4j-core

This policy modifies events by replacing or possibly adding keys and values to the MapMessage.

XML snippet
<PropertiesRewritePolicy/>
Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

key/value pairs for the new keys and values.

Rewrite

Class

org.apache.logging.log4j.core.appender.rewrite.RewriteAppender

Provider

org.apache.logging.log4j:log4j-core

This Appender allows the logging event to be manipulated before it is processed by other Appenders.

XML snippet
<Rewrite ignoreExceptions=""
         name="">
    <a-Filter-implementation/>
    <a-RewritePolicy-implementation/>
    <AppenderRef/><!-- multiple occurrences allowed -->
</Rewrite>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

ignoreExceptions

String?

If "true" (default) exceptions encountered when appending events are logged; otherwise they are propagated to the caller.

name

String?

The name of the Appender.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

RewritePolicy?

The policy to use to modify the event.

AppenderRef

AppenderRef?

An array of Appender names to call.

Filter?

A Filter to filter events.

RewritePolicy

Class

org.apache.logging.log4j.core.appender.rewrite.RewritePolicy

Provider

org.apache.logging.log4j:log4j-core

Interface to be implemented by components that support modifications to the LogEvent.

AbstractRolloverStrategy

Class

org.apache.logging.log4j.core.appender.rolling.AbstractRolloverStrategy

Provider

org.apache.logging.log4j:log4j-core

AbstractTriggeringPolicy

Class

org.apache.logging.log4j.core.appender.rolling.AbstractTriggeringPolicy

Provider

org.apache.logging.log4j:log4j-core

Abstract convenience class for triggering policies that extend AbstractLifeCycle and implement TriggeringPolicy.

Policies

Class

org.apache.logging.log4j.core.appender.rolling.CompositeTriggeringPolicy

Provider

org.apache.logging.log4j:log4j-core

Triggering policy that wraps other triggering policies.

XML snippet
<Policies/>
Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

TriggeringPolicy?

The triggering policies.

CronTriggeringPolicy

Class

org.apache.logging.log4j.core.appender.rolling.CronTriggeringPolicy

Provider

org.apache.logging.log4j:log4j-core

Rolls a file over based on a cron schedule.

XML snippet
<CronTriggeringPolicy evaluateOnStartup=""
                      schedule=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

evaluateOnStartup

String?

check if the file should be rolled over immediately.

schedule

String?

the cron expression.

DefaultRolloverStrategy

Class

org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy

Provider

org.apache.logging.log4j:log4j-core

When rolling over, DefaultRolloverStrategy renames files according to an algorithm as described below.

The DefaultRolloverStrategy is a combination of a time-based policy and a fixed-window policy. When the file name pattern contains a date format then the rollover time interval will be used to calculate the time to use in the file pattern. When the file pattern contains an integer replacement token one of the counting techniques will be used.

When the ascending attribute is set to true (the default) then the counter will be incremented and the current log file will be renamed to include the counter value. If the counter hits the maximum value then the oldest file, which will have the smallest counter, will be deleted, all other files will be renamed to have their counter decremented and then the current file will be renamed to have the maximum counter value. Note that with this counting strategy specifying a large maximum value may entirely avoid renaming files.

When the ascending attribute is false, then the "normal" fixed-window strategy will be used.

Let max and min represent the values of respectively the MaxIndex and MinIndex options. Let "foo. log" be the value of the ActiveFile option and "foo. %i.log" the value of FileNamePattern. Then, when rolling over, the file foo. max.log will be deleted, the file foo. max-1.log will be renamed as foo. max.log, the file foo. max-2.log renamed as foo. max-1.log, and so on, the file foo. min+1.log renamed as foo. min+2.log. Lastly, the active file foo. log will be renamed as foo. min.log and a new active file name foo. log will be created.

Given that this rollover algorithm requires as many file renaming operations as the window size, large window sizes are discouraged.

XML snippet
<DefaultRolloverStrategy compressionLevel=""
                         fileIndex=""
                         max=""
                         min=""
                         stopCustomActionsOnError=""
                         tempCompressedFilePattern="">
    <a-Action-implementation/><!-- multiple occurrences allowed -->
</DefaultRolloverStrategy>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

compressionLevel

String?

fileIndex

String?

max

String?

min

String?

stopCustomActionsOnError

boolean?

tempCompressedFilePattern

String?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Action?

DirectFileRolloverStrategy

Class

org.apache.logging.log4j.core.appender.rolling.DirectFileRolloverStrategy

Provider

org.apache.logging.log4j:log4j-core

Created by rgoers on 1/12/17.

Known implementations

DirectWriteRolloverStrategy

Class

org.apache.logging.log4j.core.appender.rolling.DirectWriteRolloverStrategy

Provider

org.apache.logging.log4j:log4j-core

When rolling over, DirectWriteRolloverStrategy writes directly to the file as resolved by the file pattern.

Files will be renamed files according to an algorithm as described below.

The DirectWriteRolloverStrategy uses similar logic as DefaultRolloverStrategy to determine the file name based on the file pattern, however the DirectWriteRolloverStrategy writes directly to a file and does not rename it during rollover, except if it is compressed, in which case it will add the appropriate file extension.

XML snippet
<DirectWriteRolloverStrategy compressionLevel=""
                             maxFiles=""
                             stopCustomActionsOnError=""
                             tempCompressedFilePattern="">
    <a-Action-implementation/><!-- multiple occurrences allowed -->
</DirectWriteRolloverStrategy>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

compressionLevel

String?

maxFiles

String?

stopCustomActionsOnError

boolean?

tempCompressedFilePattern

String?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Action?

NoOpTriggeringPolicy

Class

org.apache.logging.log4j.core.appender.rolling.NoOpTriggeringPolicy

Provider

org.apache.logging.log4j:log4j-core

XML snippet
<NoOpTriggeringPolicy/>

OnStartupTriggeringPolicy

Class

org.apache.logging.log4j.core.appender.rolling.OnStartupTriggeringPolicy

Provider

org.apache.logging.log4j:log4j-core

Triggers a rollover on every restart, but only if the file size is greater than zero.

XML snippet
<OnStartupTriggeringPolicy minSize=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

minSize

long?

RolloverStrategy

Class

org.apache.logging.log4j.core.appender.rolling.RolloverStrategy

Provider

org.apache.logging.log4j:log4j-core

A RollingPolicy specifies the actions taken on a logging file rollover.

SizeBasedTriggeringPolicy

Class

org.apache.logging.log4j.core.appender.rolling.SizeBasedTriggeringPolicy

Provider

org.apache.logging.log4j:log4j-core

XML snippet
<SizeBasedTriggeringPolicy size=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

size

String?

The size of the file before rollover is required.

TimeBasedTriggeringPolicy

Class

org.apache.logging.log4j.core.appender.rolling.TimeBasedTriggeringPolicy

Provider

org.apache.logging.log4j:log4j-core

Rolls a file over based on time.

XML snippet
<TimeBasedTriggeringPolicy interval=""
                           maxRandomDelay=""
                           modulate=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

interval

int?

maxRandomDelay

int?

modulate

boolean?

TriggeringPolicy

Class

org.apache.logging.log4j.core.appender.rolling.TriggeringPolicy

Provider

org.apache.logging.log4j:log4j-core

A TriggeringPolicy controls the conditions under which rollover occurs.

Such conditions include time of day, file size, an external event, the log request or a combination thereof.

AbstractAction

Class

org.apache.logging.log4j.core.appender.rolling.action.AbstractAction

Provider

org.apache.logging.log4j:log4j-core

Abstract base class for implementations of Action.

Known implementations

AbstractPathAction

Class

org.apache.logging.log4j.core.appender.rolling.action.AbstractPathAction

Provider

org.apache.logging.log4j:log4j-core

Abstract action for processing files that are accepted by the specified PathFilters.

Known implementations

Action

Class

org.apache.logging.log4j.core.appender.rolling.action.Action

Provider

org.apache.logging.log4j:log4j-core

The Action interface should be implemented by any class that performs file system actions for RollingFileAppenders after the close of the active log file.

Known implementations

Delete

Class

org.apache.logging.log4j.core.appender.rolling.action.DeleteAction

Provider

org.apache.logging.log4j:log4j-core

Rollover or scheduled action for deleting old log files that are accepted by the specified PathFilters.

XML snippet
<Delete basePath=""
        followLinks=""
        maxDepth=""
        testMode="">
    <a-PathCondition-implementation/><!-- multiple occurrences allowed -->
    <a-PathSorter-implementation/>
    <ScriptCondition/>
</Delete>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

basePath

String?

base path from where to start scanning for files to delete.

followLinks

boolean?

whether to follow symbolic links. Default is false.

maxDepth

int?

The maxDepth parameter is the maximum number of levels of directories to visit. A value of 0 means that only the starting file is visited, unless denied by the security manager. A value of MAX_VALUE may be used to indicate that all levels should be visited.

testMode

boolean?

if true, files are not deleted but instead a message is printed to the status logger at INFO level. Users can use this to do a dry run to test if their configuration works as expected. Default is false.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

PathCondition?

an array of path conditions (if more than one, they all need to accept a path before it is deleted).

PathSorter?

a plugin implementing the PathSorter interface

ScriptCondition

ScriptCondition?

Duration

Class

org.apache.logging.log4j.core.appender.rolling.action.Duration

Provider

org.apache.logging.log4j:log4j-core

Simplified implementation of the ISO-8601 Durations standard.

The supported format is PnDTnHnMnS, with 'P' and 'T' optional. Days are considered to be exactly 24 hours.

Similarly to the java. time. Duration class, this class does not support year or month sections in the format. This implementation does not support fractions or negative values.

IfAccumulatedFileCount

Class

org.apache.logging.log4j.core.appender.rolling.action.IfAccumulatedFileCount

Provider

org.apache.logging.log4j:log4j-core

PathCondition that accepts paths after some count threshold is exceeded during the file tree walk.

XML snippet
<IfAccumulatedFileCount exceeds="">
    <a-PathCondition-implementation/><!-- multiple occurrences allowed -->
</IfAccumulatedFileCount>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

exceeds

int?

The threshold count from which files will be deleted.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

PathCondition?

IfAccumulatedFileSize

Class

org.apache.logging.log4j.core.appender.rolling.action.IfAccumulatedFileSize

Provider

org.apache.logging.log4j:log4j-core

PathCondition that accepts paths after the accumulated file size threshold is exceeded during the file tree walk.

XML snippet
<IfAccumulatedFileSize exceeds="">
    <a-PathCondition-implementation/><!-- multiple occurrences allowed -->
</IfAccumulatedFileSize>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

exceeds

String?

The threshold accumulated file size from which files will be deleted.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

PathCondition?

IfAll

Class

org.apache.logging.log4j.core.appender.rolling.action.IfAll

Provider

org.apache.logging.log4j:log4j-core

Composite PathCondition that only accepts objects that are accepted by all component conditions.

Corresponds to logical "AND".

XML snippet
<IfAll/>
Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

PathCondition

The component filters.

IfAny

Class

org.apache.logging.log4j.core.appender.rolling.action.IfAny

Provider

org.apache.logging.log4j:log4j-core

Composite PathCondition that accepts objects that are accepted by any component conditions.

Corresponds to logical "OR".

XML snippet
<IfAny/>
Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

PathCondition

The component conditions.

IfFileName

Class

org.apache.logging.log4j.core.appender.rolling.action.IfFileName

Provider

org.apache.logging.log4j:log4j-core

PathCondition that accepts files for deletion if their relative path matches either a glob pattern or a regular expression.

If both a regular expression and a glob pattern are specified the glob pattern is used and the regular expression is ignored.

The regular expression is a pattern as defined by the java.util.regex.Pattern class. A glob is a simplified pattern expression described in java.nio.file.FileSystem#getPathMatcher(String).

XML snippet
<IfFileName glob=""
            regex="">
    <a-PathCondition-implementation/><!-- multiple occurrences allowed -->
</IfFileName>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

glob

String?

the baseDir-relative path pattern of the files to delete (may contain '*' and '?' wildcarts)

regex

String?

the regular expression that matches the baseDir-relative path of the file(s) to delete

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

PathCondition?

nested conditions to evaluate if this condition accepts a path

IfLastModified

Class

org.apache.logging.log4j.core.appender.rolling.action.IfLastModified

Provider

org.apache.logging.log4j:log4j-core

PathCondition that accepts paths that are older than the specified duration.

XML snippet
<IfLastModified age="">
    <a-PathCondition-implementation/><!-- multiple occurrences allowed -->
</IfLastModified>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

age

Duration

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

PathCondition?

IfNot

Class

org.apache.logging.log4j.core.appender.rolling.action.IfNot

Provider

org.apache.logging.log4j:log4j-core

Wrapper PathCondition that accepts objects that are rejected by the wrapped component filter.

XML snippet
<IfNot/>
Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

PathCondition

The condition to negate.

PathCondition

Class

org.apache.logging.log4j.core.appender.rolling.action.PathCondition

Provider

org.apache.logging.log4j:log4j-core

Filter that accepts or rejects a candidate Path for deletion.

SortByModificationTime

Class

org.apache.logging.log4j.core.appender.rolling.action.PathSortByModificationTime

Provider

org.apache.logging.log4j:log4j-core

PathSorter that sorts path by their LastModified attribute.

XML snippet
<SortByModificationTime recentFirst=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

recentFirst

boolean?

if true, most recently modified paths should come first.

PathSorter

Class

org.apache.logging.log4j.core.appender.rolling.action.PathSorter

Provider

org.apache.logging.log4j:log4j-core

Defines the interface of classes that can sort Paths.

Known implementations

PosixViewAttribute

Class

org.apache.logging.log4j.core.appender.rolling.action.PosixViewAttributeAction

Provider

org.apache.logging.log4j:log4j-core

File POSIX attribute view action.

Allow to define file permissions, user and group for log files on POSIX supported OS.

XML snippet
<PosixViewAttribute basePath=""
                    fileGroup=""
                    fileOwner=""
                    filePermissions=""
                    followLinks=""
                    maxDepth="">
    <a-PathCondition-implementation/><!-- multiple occurrences allowed -->
</PosixViewAttribute>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

basePath

String

fileGroup

String?

fileOwner

String?

filePermissions

String?

followLinks

boolean?

maxDepth

int?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

PathCondition?

ScriptCondition

Class

org.apache.logging.log4j.core.appender.rolling.action.ScriptCondition

Provider

org.apache.logging.log4j:log4j-core

A condition of the DeleteAction where a user-provided script selects the files to delete from a provided list.

The specified script may be a org.apache.logging.log4j.core.appender.rolling.action.org.apache.logging.log4j.core.script.Script, a ScriptFile or a ScriptRef.

XML snippet
<ScriptCondition/>
Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

AbstractScript?

The script to run. This may be a org.apache.logging.log4j.core.appender.rolling.action.org.apache.logging.log4j.core.script.Script, a ScriptFile or a ScriptRef. The script must return a List<PathWithAttributes>. When the script is executed, it is provided the following bindings:

  • basePath - the directory from where the Delete action started scanning for files to delete. Can be used to relativize the paths in the pathList.

  • pathList - a java. util. List containing org.apache.logging.log4j.core.appender.rolling.action.PathWithAttributes objects. (The script is free to modify and return this list. )

  • substitutor - a org.apache.logging.log4j.core.appender.rolling.action.org.apache.logging.log4j.core.lookup.StrSubstitutor that can be used to look up variables embedded in the base dir or other properties

  • statusLogger - the org.apache.logging.log4j.status.StatusLogger that can be used to log events during script execution

  • any properties declared in the configuration

IdlePurgePolicy

Class

org.apache.logging.log4j.core.appender.routing.IdlePurgePolicy

Provider

org.apache.logging.log4j:log4j-core

Policy is purging appenders that were not in use specified time in minutes

XML snippet
<IdlePurgePolicy checkInterval=""
                 timeToLive=""
                 timeUnit=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

checkInterval

String?

when all appenders purged, the number of increments of timeUnit to check if any appenders appeared

timeToLive

String?

the number of increments of timeUnit before the Appender should be purged.

timeUnit

String?

the unit of time the timeToLive and the checkInterval is expressed in.

PurgePolicy

Class

org.apache.logging.log4j.core.appender.routing.PurgePolicy

Provider

org.apache.logging.log4j:log4j-core

Policy for purging routed appenders

Known implementations

Route

Class

org.apache.logging.log4j.core.appender.routing.Route

Provider

org.apache.logging.log4j:log4j-core

A Route to an appender.

XML snippet
<Route key=""
       ref=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

key

String?

The key.

ref

String?

The Appender reference.

Routes

Class

org.apache.logging.log4j.core.appender.routing.Routes

Provider

org.apache.logging.log4j:log4j-core

Contains the individual Route elements.

XML snippet
<Routes pattern="">
    <Route/><!-- multiple occurrences allowed -->
    <a-AbstractScript-implementation/>
</Routes>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

pattern

String?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Route

Route

AbstractScript?

Routing

Class

org.apache.logging.log4j.core.appender.routing.RoutingAppender

Provider

org.apache.logging.log4j:log4j-core

This Appender "routes" between various Appenders, some of which can be references to Appenders defined earlier in the configuration while others can be dynamically created within this Appender as required.

Routing is achieved by specifying a pattern on the Routing appender declaration. The pattern should contain one or more substitution patterns of the form "$${[key:]token}". The pattern will be resolved each time the Appender is called using the built in StrSubstitutor and the StrLookup plugin that matches the specified key.

XML snippet
<Routing ignoreExceptions=""
         name="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <a-RewritePolicy-implementation/>
    <a-PurgePolicy-implementation/>
    <Routes/>
    <Property/><!-- multiple occurrences allowed -->
    <a-AbstractScript-implementation/>
</Routing>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

ignoreExceptions

boolean?

name

String

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

RewritePolicy?

PurgePolicy?

Routes

Routes?

Property

Property?

Filter?

Layout?

AbstractScript?

ArrayBlockingQueue

Class

org.apache.logging.log4j.core.async.ArrayBlockingQueueFactory

Provider

org.apache.logging.log4j:log4j-core

Factory for creating instances of java.util.concurrent.ArrayBlockingQueue.

XML snippet
<ArrayBlockingQueue/>

AsyncLogger

Class

org.apache.logging.log4j.core.async.AsyncLoggerConfig

Provider

org.apache.logging.log4j:log4j-core

Asynchronous Logger object that is created via configuration and can be combined with synchronous loggers.

AsyncLoggerConfig is a logger designed for high throughput and low latency logging. It does not perform any I/O in the calling (application) thread, but instead hands off the work to another thread as soon as possible. The actual logging is performed in the background thread. It uses LMAX Disruptor for inter-thread communication.

To use AsyncLoggerConfig, specify <asyncLogger> or <asyncRoot> in configuration.

Note that for performance reasons, this logger does not include source location by default. You need to specify includeLocation="true" in the configuration or any %class, %location or %line conversion patterns in your log4j. xml configuration will produce either a "?" character or no output at all.

For best performance, use AsyncLoggerConfig with the RandomAccessFileAppender or RollingRandomAccessFileAppender, with immediateFlush=false. These appenders have built-in support for the batching mechanism used by the Disruptor library, and they will flush to disk at the end of each batch. This means that even with immediateFlush=false, there will never be any items left in the buffer; all log events will all be written to disk in a very efficient manner.

XML snippet
<AsyncLogger additivity=""
             includeLocation=""
             level=""
             levelAndRefs=""
             name="">
    <a-Filter-implementation/>
    <AppenderRef/><!-- multiple occurrences allowed -->
    <Property/><!-- multiple occurrences allowed -->
</AsyncLogger>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

additivity

Boolean?

includeLocation

String?

level

Level?

levelAndRefs

String?

name

String

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

AppenderRef

AppenderRef?

Property

Property?

Filter?

AsyncRoot

Class

org.apache.logging.log4j.core.async.AsyncLoggerConfig.RootLogger

Provider

org.apache.logging.log4j:log4j-core

An asynchronous root Logger.

XML snippet
<AsyncRoot additivity=""
           includeLocation=""
           level=""
           levelAndRefs="">
    <a-Filter-implementation/>
    <AppenderRef/><!-- multiple occurrences allowed -->
    <Property/><!-- multiple occurrences allowed -->
</AsyncRoot>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

additivity

boolean?

includeLocation

String?

level

Level?

levelAndRefs

String?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

AppenderRef

AppenderRef?

Property

Property?

Filter?

AsyncWaitStrategyFactory

Class

org.apache.logging.log4j.core.async.AsyncWaitStrategyFactoryConfig

Provider

org.apache.logging.log4j:log4j-core

This class allows users to configure the factory used to create an instance of the LMAX disruptor WaitStrategy used by Async Loggers in the log4j configuration.

XML snippet
<AsyncWaitStrategyFactory class=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

class

String

BlockingQueueFactory

Class

org.apache.logging.log4j.core.async.BlockingQueueFactory

Provider

org.apache.logging.log4j:log4j-core

Factory for creating instances of java.util.concurrent.BlockingQueue.

DisruptorBlockingQueue

Class

org.apache.logging.log4j.core.async.DisruptorBlockingQueueFactory

Provider

org.apache.logging.log4j:log4j-core

Factory for creating instances of com.conversantmedia.util.concurrent.DisruptorBlockingQueue.

XML snippet
<DisruptorBlockingQueue SpinPolicy=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

SpinPolicy

SpinPolicy?

JCToolsBlockingQueue

Class

org.apache.logging.log4j.core.async.JCToolsBlockingQueueFactory

Provider

org.apache.logging.log4j:log4j-core

Factory for creating instances of BlockingQueues backed by JCTools org.jctools.queues.MpscArrayQueue.

XML snippet
<JCToolsBlockingQueue WaitStrategy=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

WaitStrategy

WaitStrategy?

WaitStrategy

Class

org.apache.logging.log4j.core.async.JCToolsBlockingQueueFactory.WaitStrategy

Provider

org.apache.logging.log4j:log4j-core

LinkedTransferQueue

Class

org.apache.logging.log4j.core.async.LinkedTransferQueueFactory

Provider

org.apache.logging.log4j:log4j-core

Factory for creating instances of java.util.concurrent.LinkedTransferQueue.

XML snippet
<LinkedTransferQueue/>

AppenderRef

Class

org.apache.logging.log4j.core.config.AppenderRef

Provider

org.apache.logging.log4j:log4j-core

An Appender reference.

XML snippet
<AppenderRef level=""
             ref="">
    <a-Filter-implementation/>
</AppenderRef>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

level

Level?

The Level to filter against.

ref

String?

The name of the Appender.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Filter?

The filter(s) to use.

Appenders

Class

org.apache.logging.log4j.core.config.AppendersPlugin

Provider

org.apache.logging.log4j:log4j-core

An Appender container.

XML snippet
<Appenders/>
Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Appender?

An array of Appenders.

Configuration

Class

org.apache.logging.log4j.core.config.Configuration

Provider

org.apache.logging.log4j:log4j-core

A Log4j configuration contains many components of which two are required: Appenders and Loggers.

XML snippet
<Configuration dest="err"
               monitorInterval="0"
               name=""
               schema=""
               shutdownHook=""
               shutdownTimeout=""
               status="ERROR"
               strict="false">
    <Properties/>
    <Appenders/>
    <CustomLevels/>
    <Loggers/>
</Configuration>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

dest

String?

err

Specifies the destination for status logger events. The possible values are:

  • out for using standard out (default)

  • err for using standard error

  • a string that is interpreted in order as URI, URL or the path to a local file

If the provided value is invalid, then the default destination of standard out will be used.

monitorInterval

int?

0

Number of seconds between polls for configuration changes

name

String

Name of the configuration

schema

String?

The name of a classpath resource to use to validate the configuration

shutdownHook

String?

Indicates if Log4j should automatically shut down when the JVM shuts down. Possible values are enable and disable. The shutdown hook is enabled by default, unless Log4j detects the presence of the Servlet API.

shutdownTimeout

int?

Timeout in milliseconds of the logger context shut down

status

Level?

ERROR

Sets the level of the status logger

strict

boolean?

false

If set to true the configuration file will be validated using an XML schema.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Appenders

AppendersPlugin

Wrapper element for a list of appenders

CustomLevels

CustomLevels?

Wrapper element for a list of custom levels

Loggers

LoggersPlugin?

Wrapper element for a list of logger configurations

Properties

PropertiesPlugin?

Wrapper element for a list of properties

ConfigurationAware

Class

org.apache.logging.log4j.core.config.ConfigurationAware

Provider

org.apache.logging.log4j:log4j-core

Indicates that a class requests the current Configuration to be injected.

Known implementations

ConfigurationFactory

Class

org.apache.logging.log4j.core.config.ConfigurationFactory

Provider

org.apache.logging.log4j:log4j-core

Factory class for parsed org.apache.logging.log4j.core.config.Configuration objects from a configuration file.

ConfigurationFactory allows the configuration implementation to be dynamically chosen in 1 of 3 ways:

  1. A system property named "log4j. configurationFactory" can be set with the name of the ConfigurationFactory to be used.

  2. ConfigurationFactory can be called with the instance of the ConfigurationFactory to be used. This must be called before any other calls to Log4j.

  3. A ConfigurationFactory implementation can be added to the classpath and configured as a plugin in the ConfigurationFactory category. The org.apache.logging.log4j.core.config.Order annotation should be used to configure the factory to be the first one inspected. See XmlConfigurationFactory for an example.

If the ConfigurationFactory that was added returns null on a call to getConfiguration then any other ConfigurationFactories found as plugins will be called in their respective order. DefaultConfiguration is always called last if no configuration has been returned.

CustomLevel

Class

org.apache.logging.log4j.core.config.CustomLevelConfig

Provider

org.apache.logging.log4j:log4j-core

Descriptor of a custom Level object that is created via configuration.

XML snippet
<CustomLevel intLevel=""
             name=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

intLevel

int?

the intLevel that determines where this level resides relative to the built-in levels

name

String?

name of the custom level.

CustomLevels

Class

org.apache.logging.log4j.core.config.CustomLevels

Provider

org.apache.logging.log4j:log4j-core

Container for CustomLevelConfig objects.

XML snippet
<CustomLevels/>
Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

CustomLevel

CustomLevelConfig?

An array of CustomLevelConfigs.

Default

Class

org.apache.logging.log4j.core.config.DefaultAdvertiser

Provider

org.apache.logging.log4j:log4j-core

The default advertiser does not do anything.

XML snippet
<Default/>

http

Class

org.apache.logging.log4j.core.config.HttpWatcher

Provider

org.apache.logging.log4j:log4j-core

XML snippet
<http/>

Logger

Class

org.apache.logging.log4j.core.config.LoggerConfig

Provider

org.apache.logging.log4j:log4j-core

Logger object that is created via configuration.

XML snippet
<Logger additivity=""
        includeLocation=""
        level=""
        levelAndRefs=""
        name="">
    <a-Filter-implementation/>
    <AppenderRef/><!-- multiple occurrences allowed -->
    <Property/><!-- multiple occurrences allowed -->
</Logger>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

additivity

Boolean?

includeLocation

String?

level

Level?

levelAndRefs

String?

name

String

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

AppenderRef

AppenderRef?

Property

Property?

Filter?

Known implementations

Root

Class

org.apache.logging.log4j.core.config.LoggerConfig.RootLogger

Provider

org.apache.logging.log4j:log4j-core

The root Logger.

XML snippet
<Root additivity=""
      includeLocation=""
      level=""
      levelAndRefs="">
    <a-Filter-implementation/>
    <AppenderRef/><!-- multiple occurrences allowed -->
    <Property/><!-- multiple occurrences allowed -->
</Root>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

additivity

boolean?

includeLocation

String?

level

Level?

levelAndRefs

String?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

AppenderRef

AppenderRef?

Property

Property?

Filter?

Loggers

Class

org.apache.logging.log4j.core.config.LoggersPlugin

Provider

org.apache.logging.log4j:log4j-core

Container of Logger objects.

XML snippet
<Loggers/>
Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Logger

LoggerConfig?

An array of Loggers.

Properties

Class

org.apache.logging.log4j.core.config.PropertiesPlugin

Provider

org.apache.logging.log4j:log4j-core

Handles properties defined in the configuration.

XML snippet
<Properties/>
Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

An array of Property elements.

Property

Class

org.apache.logging.log4j.core.config.Property

Provider

org.apache.logging.log4j:log4j-core

Represents a key/value pair in the configuration.

XML snippet
<Property name=""
          value=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

name

String?

The key.

value

String?

The value without any substitution applied.

Scripts

Class

org.apache.logging.log4j.core.config.ScriptsPlugin

Provider

org.apache.logging.log4j:log4j-core

A container of Scripts.

XML snippet
<Scripts/>
Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

AbstractScript?

An array of Scripts.

Arbiter

Class

org.apache.logging.log4j.core.config.arbiters.Arbiter

Provider

org.apache.logging.log4j:log4j-core

Interface used to check for portions of the configuration that may be optionally included.

ClassArbiter

Class

org.apache.logging.log4j.core.config.arbiters.ClassArbiter

Provider

org.apache.logging.log4j:log4j-core

Conditional that determines if the specified class is present.

XML snippet
<ClassArbiter className=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

className

String?

Sets the Class name.

DefaultArbiter

Class

org.apache.logging.log4j.core.config.arbiters.DefaultArbiter

Provider

org.apache.logging.log4j:log4j-core

Default Condition for a Select Condition.

XML snippet
<DefaultArbiter/>

EnvironmentArbiter

Class

org.apache.logging.log4j.core.config.arbiters.EnvironmentArbiter

Provider

org.apache.logging.log4j:log4j-core

Condition that determines if the specified environment variable is set.

XML snippet
<EnvironmentArbiter propertyName=""
                    propertyValue=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

propertyName

String?

Sets the Property Name.

propertyValue

String?

Sets the Property Value.

ScriptArbiter

Class

org.apache.logging.log4j.core.config.arbiters.ScriptArbiter

Provider

org.apache.logging.log4j:log4j-core

Condition that evaluates a script.

XML snippet
<ScriptArbiter/>

Select

Class

org.apache.logging.log4j.core.config.arbiters.SelectArbiter

Provider

org.apache.logging.log4j:log4j-core

Class Description goes here.

XML snippet
<Select/>

SystemPropertyArbiter

Class

org.apache.logging.log4j.core.config.arbiters.SystemPropertyArbiter

Provider

org.apache.logging.log4j:log4j-core

Condition that determines if the specified property is set.

XML snippet
<SystemPropertyArbiter propertyName=""
                       propertyValue=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

propertyName

String?

Sets the Property Name.

propertyValue

String?

Sets the Property Value.

ConfigurationBuilderFactory

Class

org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilderFactory

Provider

org.apache.logging.log4j:log4j-core

Provides methods to create ConfigurationBuilders.

JsonConfigurationFactory

Class

org.apache.logging.log4j.core.config.json.JsonConfigurationFactory

Provider

org.apache.logging.log4j:log4j-core

XML snippet
<JsonConfigurationFactory/>

BigDecimal

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.BigDecimalConverter

Provider

org.apache.logging.log4j:log4j-core

Parses a java.lang.String into a java.math.BigDecimal.

XML snippet
<BigDecimal/>

BigInteger

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.BigIntegerConverter

Provider

org.apache.logging.log4j:log4j-core

Parses a java.lang.String into a java.math.BigInteger.

XML snippet
<BigInteger/>

Boolean

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.BooleanConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.lang.Boolean.

XML snippet
<Boolean/>

ByteArray

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.ByteArrayConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a byte[].

The supported formats are:

  • 0x0123456789ABCDEF

  • Base64:ABase64String

  • String using java.nio.charset.Charset#defaultCharset() [TODO Should this be UTF-8 instead? ]

XML snippet
<ByteArray/>

Byte

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.ByteConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.lang.Byte.

XML snippet
<Byte/>

CharacterArray

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.CharArrayConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a char[].

XML snippet
<CharacterArray/>

Character

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.CharacterConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.lang.Character.

XML snippet
<Character/>

Charset

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.CharsetConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.nio.charset.Charset.

XML snippet
<Charset/>

Class

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.ClassConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.lang.Class.

XML snippet
<Class/>

CronExpression

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.CronExpressionConverter

Provider

org.apache.logging.log4j:log4j-core

XML snippet
<CronExpression/>

Double

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.DoubleConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.lang.Double.

XML snippet
<Double/>

Duration

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.DurationConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.org.apache.logging.log4j.core.appender.rolling.action.Duration.

XML snippet
<Duration/>

File

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.FileConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.io.File.

XML snippet
<File/>

Float

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.FloatConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.lang.Float.

XML snippet
<Float/>

InetAddress

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.InetAddressConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into an java.net.InetAddress.

XML snippet
<InetAddress/>

Integer

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.IntegerConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.lang.Integer.

XML snippet
<Integer/>

Level

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.LevelConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a Log4j Level.

Returns null for invalid level names.

XML snippet
<Level/>

Long

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.LongConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.lang.Long.

XML snippet
<Long/>

Path

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.PathConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.nio.file.Path.

XML snippet
<Path/>

Pattern

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.PatternConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.util.regex.Pattern.

XML snippet
<Pattern/>

SecurityProvider

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.SecurityProviderConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.security.Provider.

XML snippet
<SecurityProvider/>

Short

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.ShortConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.lang.Short.

XML snippet
<Short/>

String

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.StringConverter

Provider

org.apache.logging.log4j:log4j-core

Returns the given java.lang.String, no conversion takes place.

XML snippet
<String/>

URI

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.UriConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.net.URI.

XML snippet
<URI/>

URL

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.UrlConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.net.URL.

XML snippet
<URL/>

UUID

Class

org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.UuidConverter

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.util.UUID.

XML snippet
<UUID/>

PropertiesConfigurationFactory

Class

org.apache.logging.log4j.core.config.properties.PropertiesConfigurationFactory

Provider

org.apache.logging.log4j:log4j-core

Creates a PropertiesConfiguration from a properties file.

XML snippet
<PropertiesConfigurationFactory/>

XmlConfigurationFactory

Class

org.apache.logging.log4j.core.config.xml.XmlConfigurationFactory

Provider

org.apache.logging.log4j:log4j-core

Factory to construct an XmlConfiguration.

XML snippet
<XmlConfigurationFactory/>

YamlConfigurationFactory

Class

org.apache.logging.log4j.core.config.yaml.YamlConfigurationFactory

Provider

org.apache.logging.log4j:log4j-core

XML snippet
<YamlConfigurationFactory/>

AbstractFilter

Class

org.apache.logging.log4j.core.filter.AbstractFilter

Provider

org.apache.logging.log4j:log4j-core

Users should extend this class to implement filters.

Filters can be either context wide or attached to an appender. A filter may choose to support being called only from the context or only from an appender in which case it will only implement the required method(s). The rest will default to return org.apache.logging.log4j.core.filter.org.apache.logging.log4j.core.Filter.Result#NEUTRAL.

Garbage-free note: the methods with unrolled varargs by default delegate to the apiref:org.apache.logging.log4j.core.filter.AbstractFilter#filter(Logger, Level, Marker, String, Object…​)[filter method with vararg parameters]. Subclasses that want to be garbage-free should override these methods to implement the appropriate filtering without creating a vararg array.

BurstFilter

Class

org.apache.logging.log4j.core.filter.BurstFilter

Provider

org.apache.logging.log4j:log4j-core

The BurstFilter is a logging filter that regulates logging traffic.

Use this filter when you want to control the maximum burst of log statements that can be sent to an appender. The filter is configured in the log4j configuration file. For example, the following configuration limits the number of INFO level (as well as DEBUG and TRACE) log statements that can be sent to the console to a burst of 100 with an average rate of 16 per second. WARN, ERROR and FATAL messages would continue to be delivered. <Console name="console"> <PatternLayout pattern="%-5p %d{dd-MMM-yyyy HH:mm:ss} %x %t %m%n"/> <Filters> <BurstFilter level="INFO" rate="16" maxBurst="100"/> </Filters> </Console>

XML snippet
<BurstFilter level=""
             maxBurst=""
             onMatch=""
             onMismatch=""
             rate=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

level

Level?

Sets the logging level to use.

maxBurst

long?

Sets the maximum number of events that can occur before events are filtered for exceeding the average rate.

onMatch

Result?

Sets the Result to return when the filter matches.

Defaults to Result. NEUTRAL.

onMismatch

Result?

Sets the Result to return when the filter does not match.

The default is Result. DENY.

rate

float?

Sets the average number of events per second to allow.

Filters

Class

org.apache.logging.log4j.core.filter.CompositeFilter

Provider

org.apache.logging.log4j:log4j-core

Composes and invokes one or more filters.

XML snippet
<Filters/>
Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Filter?

An array of Filters to call.

DenyAllFilter

Class

org.apache.logging.log4j.core.filter.DenyAllFilter

Provider

org.apache.logging.log4j:log4j-core

This filter causes all logging events to be dropped.

XML snippet
<DenyAllFilter onMatch=""
               onMismatch=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

onMatch

Result?

Sets the Result to return when the filter matches.

Defaults to Result. NEUTRAL.

onMismatch

Result?

Sets the Result to return when the filter does not match.

The default is Result. DENY.

DynamicThresholdFilter

Class

org.apache.logging.log4j.core.filter.DynamicThresholdFilter

Provider

org.apache.logging.log4j:log4j-core

Compares against a log level that is associated with a context value.

By default the context is the org.apache.logging.log4j.ThreadContext, but users may configure a custom org.apache.logging.log4j.core.ContextDataInjector which obtains context data from some other source.

XML snippet
<DynamicThresholdFilter defaultThreshold=""
                        key=""
                        onMatch=""
                        onMismatch="">
    <KeyValuePair/><!-- multiple occurrences allowed -->
</DynamicThresholdFilter>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

defaultThreshold

Level?

The default Level.

key

String?

The name of the key to compare.

onMatch

Result?

The action to perform if a match occurs.

onMismatch

Result?

The action to perform if no match occurs.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

KeyValuePair

KeyValuePair?

An array of value and Level pairs.

LevelMatchFilter

Class

org.apache.logging.log4j.core.filter.LevelMatchFilter

Provider

org.apache.logging.log4j:log4j-core

This filter returns the onMatch result if the logging level in the event matches the specified logging level exactly.

XML snippet
<LevelMatchFilter level=""
                  onMatch=""
                  onMismatch=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

level

Level?

Sets the logging level to use.

onMatch

Result?

Sets the Result to return when the filter matches.

Defaults to Result. NEUTRAL.

onMismatch

Result?

Sets the Result to return when the filter does not match.

The default is Result. DENY.

LevelRangeFilter

Class

org.apache.logging.log4j.core.filter.LevelRangeFilter

Provider

org.apache.logging.log4j:log4j-core

This filter returns the LevelRangeFilter result if the level of the org.apache.logging.log4j.core.LogEvent is in the range of the configured LevelRangeFilter and LevelRangeFilter values, otherwise it returns the LevelRangeFilter result.

The default values for LevelRangeFilter and LevelRangeFilter are set to Level and Level, respectively. The default values for LevelRangeFilter and LevelRangeFilter are set to org.apache.logging.log4j.core.filter.Result#NEUTRAL and org.apache.logging.log4j.core.filter.Result#DENY, respectively.

The levels get compared by their associated integral values; Level has an integral value of 0, Level 100, Level 200, and so on. For example, if the filter is configured with LevelRangeFilter set to Level, the filter will return LevelRangeFilter result for org.apache.logging.log4j.core.LogEvents of level with higher integral values; Level, Level, etc.

XML snippet
<LevelRangeFilter maxLevel=""
                  minLevel=""
                  onMatch=""
                  onMismatch=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

maxLevel

Level?

the maximum level threshold

minLevel

Level?

the minimum level threshold

onMatch

Result?

the result to return on a match

onMismatch

Result?

the result to return on a mismatch

MapFilter

Class

org.apache.logging.log4j.core.filter.MapFilter

Provider

org.apache.logging.log4j:log4j-core

A Filter that operates on a Map.

XML snippet
<MapFilter onMatch=""
           onMismatch=""
           operator="">
    <KeyValuePair/><!-- multiple occurrences allowed -->
</MapFilter>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

onMatch

Result?

onMismatch

Result?

operator

String?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

KeyValuePair

KeyValuePair?

MarkerFilter

Class

org.apache.logging.log4j.core.filter.MarkerFilter

Provider

org.apache.logging.log4j:log4j-core

This filter returns the onMatch result if the marker in the LogEvent is the same as or has the configured marker as a parent.

XML snippet
<MarkerFilter marker=""
              onMatch=""
              onMismatch=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

marker

String?

The Marker name to match.

onMatch

Result?

The action to take if a match occurs.

onMismatch

Result?

The action to take if no match occurs.

MutableThreadContextMapFilter

Class

org.apache.logging.log4j.core.filter.MutableThreadContextMapFilter

Provider

org.apache.logging.log4j:log4j-core

Filter based on a value in the Thread Context Map (MDC).

XML snippet
<MutableThreadContextMapFilter configLocation=""
                               onMatch=""
                               onMismatch=""
                               pollInterval=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

configLocation

String?

Sets the configuration to use.

onMatch

Result?

Sets the Result to return when the filter matches.

Defaults to Result. NEUTRAL.

onMismatch

Result?

Sets the Result to return when the filter does not match.

The default is Result. DENY.

pollInterval

long?

Set the frequency in seconds that changes to the list a ThreadContext valudes should be checked.

NoMarkerFilter

Class

org.apache.logging.log4j.core.filter.NoMarkerFilter

Provider

org.apache.logging.log4j:log4j-core

This filter returns the onMatch result if there is no marker in the LogEvent.

XML snippet
<NoMarkerFilter onMatch=""
                onMismatch=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

onMatch

Result?

Sets the Result to return when the filter matches.

Defaults to Result. NEUTRAL.

onMismatch

Result?

Sets the Result to return when the filter does not match.

The default is Result. DENY.

RegexFilter

Class

org.apache.logging.log4j.core.filter.RegexFilter

Provider

org.apache.logging.log4j:log4j-core

A filter that matches the given regular expression pattern against messages.

XML snippet
<RegexFilter onMatch=""
             onMismatch=""
             regex=""
             useRawMsg="">
    <a-String-implementation/><!-- multiple occurrences allowed -->
</RegexFilter>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

onMatch

Result?

The action to perform when a match occurs.

onMismatch

Result?

The action to perform when a mismatch occurs.

regex

String?

The regular expression to match.

useRawMsg

Boolean?

If true, for org.apache.logging.log4j.message.ParameterizedMessage, org.apache.logging.log4j.message.StringFormattedMessage, and org.apache.logging.log4j.message.MessageFormatMessage, the message format pattern; for org.apache.logging.log4j.message.StructuredDataMessage, the message field will be used as the match target.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

String?

An array of Strings where each String is a java.util.regex.Pattern#compile(String,int) compilation flag.

ScriptFilter

Class

org.apache.logging.log4j.core.filter.ScriptFilter

Provider

org.apache.logging.log4j:log4j-core

Returns the onMatch result if the script returns True and returns the onMismatch value otherwise.

XML snippet
<ScriptFilter onMatch=""
              onMismatch="">
    <a-AbstractScript-implementation/>
</ScriptFilter>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

onMatch

Result?

The action to take if a match occurs.

onMismatch

Result?

The action to take if no match occurs.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

AbstractScript?

The script to run. The script must return a boolean value. Either script or scriptFile must be provided.

StringMatchFilter

Class

org.apache.logging.log4j.core.filter.StringMatchFilter

Provider

org.apache.logging.log4j:log4j-core

This filter returns the onMatch result if the logging level in the event matches the specified logging level exactly.

XML snippet
<StringMatchFilter onMatch=""
                   onMismatch=""
                   text=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

onMatch

Result?

Sets the Result to return when the filter matches.

Defaults to Result. NEUTRAL.

onMismatch

Result?

Sets the Result to return when the filter does not match.

The default is Result. DENY.

text

String

Sets the text to search in event messages.

StructuredDataFilter

Class

org.apache.logging.log4j.core.filter.StructuredDataFilter

Provider

org.apache.logging.log4j:log4j-core

Filter based on data in a StructuredDataMessage.

XML snippet
<StructuredDataFilter onMatch=""
                      onMismatch=""
                      operator="">
    <KeyValuePair/><!-- multiple occurrences allowed -->
</StructuredDataFilter>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

onMatch

Result?

The action to perform on a match.

onMismatch

Result?

The action to perform on a mismatch.

operator

String?

The operator to perform. If not "or" the operation will be an "and".

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

KeyValuePair

KeyValuePair?

Key and value pairs.

ThreadContextMapFilter

Class

org.apache.logging.log4j.core.filter.ThreadContextMapFilter

Provider

org.apache.logging.log4j:log4j-core

Filter based on a value in the Thread Context Map (MDC).

XML snippet
<ThreadContextMapFilter onMatch=""
                        onMismatch=""
                        operator="">
    <KeyValuePair/><!-- multiple occurrences allowed -->
</ThreadContextMapFilter>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

onMatch

Result?

onMismatch

Result?

operator

String?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

KeyValuePair

KeyValuePair?

ThresholdFilter

Class

org.apache.logging.log4j.core.filter.ThresholdFilter

Provider

org.apache.logging.log4j:log4j-core

This filter returns the onMatch result if the level in the org.apache.logging.log4j.core.LogEvent is the same or more specific than the configured level and the onMismatch value otherwise.

For example, if the ThresholdFilter is configured with Level ERROR and the LogEvent contains Level DEBUG then the onMismatch value will be returned since ERROR events are more specific than DEBUG.

The default Level is ERROR.

XML snippet
<ThresholdFilter level=""
                 onMatch=""
                 onMismatch=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

level

Level?

The log Level.

onMatch

Result?

The action to take on a match.

onMismatch

Result?

The action to take on a mismatch.

TimeFilter

Class

org.apache.logging.log4j.core.filter.TimeFilter

Provider

org.apache.logging.log4j:log4j-core

Filters events that fall within a specified time period in each day.

XML snippet
<TimeFilter end=""
            onMatch=""
            onMismatch=""
            start=""
            timezone=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

end

String?

The end time.

onMatch

Result?

Action to perform if the time matches.

onMismatch

Result?

Action to perform if the action does not match.

start

String?

The start time.

timezone

String?

timezone.

AbstractCsvLayout

Class

org.apache.logging.log4j.core.layout.AbstractCsvLayout

Provider

org.apache.logging.log4j:log4j-core

A superclass for Comma-Separated Value (CSV) layouts.

Depends on Apache Commons CSV 1.2.

Known implementations

AbstractJacksonLayout

Class

org.apache.logging.log4j.core.layout.AbstractJacksonLayout

Provider

org.apache.logging.log4j:log4j-core

Known implementations

AbstractLayout

Class

org.apache.logging.log4j.core.layout.AbstractLayout

Provider

org.apache.logging.log4j:log4j-core

Abstract base class for Layouts.

AbstractStringLayout

Class

org.apache.logging.log4j.core.layout.AbstractStringLayout

Provider

org.apache.logging.log4j:log4j-core

Abstract base class for Layouts that result in a String.

Since 2.4.1, this class has custom logic to convert ISO-8859-1 or US-ASCII Strings to byte[] arrays to improve performance: all characters are simply cast to bytes.

CsvLogEventLayout

Class

org.apache.logging.log4j.core.layout.CsvLogEventLayout

Provider

org.apache.logging.log4j:log4j-core

A Comma-Separated Value (CSV) layout to log events.

Depends on Apache Commons CSV 1.2.

XML snippet
<CsvLogEventLayout charset=""
                   delimiter=""
                   escape=""
                   footer=""
                   format=""
                   header=""
                   nullString=""
                   quote=""
                   quoteMode=""
                   recordSeparator=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

charset

Charset?

delimiter

Character?

escape

Character?

footer

String?

format

String?

header

String?

nullString

String?

quote

Character?

quoteMode

QuoteMode?

recordSeparator

String?

CsvParameterLayout

Class

org.apache.logging.log4j.core.layout.CsvParameterLayout

Provider

org.apache.logging.log4j:log4j-core

A Comma-Separated Value (CSV) layout to log event parameters.

The event message is currently ignored.

Best used with:

logger. debug(new ObjectArrayMessage(1, 2, "Bob")); Depends on Apache Commons CSV 1.4.

XML snippet
<CsvParameterLayout charset=""
                    delimiter=""
                    escape=""
                    footer=""
                    format=""
                    header=""
                    nullString=""
                    quote=""
                    quoteMode=""
                    recordSeparator=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

charset

Charset?

delimiter

Character?

escape

Character?

footer

String?

format

String?

header

String?

nullString

String?

quote

Character?

quoteMode

QuoteMode?

recordSeparator

String?

Encoder

Class

org.apache.logging.log4j.core.layout.Encoder

Provider

org.apache.logging.log4j:log4j-core

Objects implementing the Encoder interface know how to convert an object to some binary representation and write the result to a ByteBuffer, ideally without creating temporary objects.

GelfLayout

Class

org.apache.logging.log4j.core.layout.GelfLayout

Provider

org.apache.logging.log4j:log4j-core

Lays out events in the Graylog Extended Log Format (GELF) 1.1.

This layout compresses JSON to GZIP or ZLIB (the compressionType) if log event data is larger than 1024 bytes (the compressionThreshold). This layout does not implement chunking.

XML snippet
<GelfLayout charset=""
            compressionThreshold=""
            compressionType=""
            footer=""
            header=""
            host=""
            includeMapMessage=""
            includeNewLineDelimiter=""
            includeNullDelimiter=""
            includeStacktrace=""
            includeThreadContext=""
            mapMessageExcludes=""
            mapMessageIncludes=""
            mapPrefix=""
            messagePattern=""
            omitEmptyFields=""
            threadContextExcludes=""
            threadContextIncludes=""
            threadContextPrefix="">
    <a-Serializer-implementation/>
    <a-PatternSelector-implementation/>
    <KeyValuePair/><!-- multiple occurrences allowed -->
</GelfLayout>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

charset

Charset?

compressionThreshold

int?

Compress if data is larger than this number of bytes (optional, defaults to 1024).

compressionType

CompressionType?

Compression to use (optional, defaults to GZIP).

footer

String?

header

String?

host

String?

The value of the host property (optional, defaults to local host name).

includeMapMessage

boolean?

Whether to include MapMessage fields as additional fields (optional, default to true).

includeNewLineDelimiter

boolean?

Whether to include newline (LF) as delimiter after each event (optional, default to false).

includeNullDelimiter

boolean?

Whether to include NULL byte as delimiter after each event (optional, default to false).

Useful for Graylog GELF TCP input.

includeStacktrace

boolean?

Whether to include full stacktrace of logged Throwables (optional, default to true).

If set to false, only the class name and message of the Throwable will be included.

includeThreadContext

boolean?

Whether to include thread context as additional fields (optional, default to true).

mapMessageExcludes

String?

A comma separated list of MapMessage keys to exclude;

mapMessageIncludes

String?

A comma separated list of thread context keys to include;

mapPrefix

String?

The String to prefix the MapMessage attributes.

messagePattern

String?

The pattern to use to format the message.

omitEmptyFields

boolean?

threadContextExcludes

String?

threadContextIncludes

String?

threadContextPrefix

String?

The String to prefix the ThreadContext attributes.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Serializer?

PatternSelector?

The PatternSelector to use to format the message.

KeyValuePair

KeyValuePair?

Additional fields to set on each log event.

CompressionType

Class

org.apache.logging.log4j.core.layout.GelfLayout.CompressionType

Provider

org.apache.logging.log4j:log4j-core

HtmlLayout

Class

org.apache.logging.log4j.core.layout.HtmlLayout

Provider

org.apache.logging.log4j:log4j-core

Outputs events as rows in an HTML table on an HTML page.

Appenders using this layout should have their encoding set to UTF-8 or UTF-16, otherwise events containing non ASCII characters could result in corrupted log files.

XML snippet
<HtmlLayout charset=""
            contentType=""
            datePattern=""
            fontName=""
            fontSize=""
            locationInfo=""
            timezone=""
            title=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

charset

Charset?

contentType

String?

datePattern

String?

fontName

String?

fontSize

FontSize?

locationInfo

boolean?

timezone

String?

title

String?

FontSize

Class

org.apache.logging.log4j.core.layout.HtmlLayout.FontSize

Provider

org.apache.logging.log4j:log4j-core

Possible font sizes

JsonLayout

Class

org.apache.logging.log4j.core.layout.JsonLayout

Provider

org.apache.logging.log4j:log4j-core

Note: The JsonLayout should be considered to be deprecated.

Please use JsonTemplateLayout instead. Appends a series of JSON events as strings serialized as bytes.

Additional Fields

If you configure complete="true", the appender outputs a well-formed JSON document. By default, with complete="false", you should include the output as an external file in a separate file to form a well-formed JSON document.

If complete="false", the appender does not write the JSON open array character "[" at the start of the document, "]" and the end, nor comma "," between records.

Appenders using this layout should have their charset set to UTF-8 or UTF-16, otherwise events containing non ASCII characters could result in corrupted log files.

By default, the JSON layout is not compact (a.k.a. "pretty") with compact="false", which means the appender uses end-of-line characters and indents lines to format the text. If compact="true", then no end-of-line or indentation is used. Message content may contain, of course, escaped end-of-lines.

This property allows addition of custom fields into generated JSON. <JsonLayout><KeyValuePair key="foo" value="bar"/></JsonLayout> inserts "foo":"bar" directly into JSON output. Supports Lookup expressions.

XML snippet
<JsonLayout charset=""
            compact=""
            complete=""
            endOfLine=""
            eventEol=""
            footer=""
            header=""
            includeNullDelimiter=""
            includeStacktrace=""
            includeTimeMillis=""
            locationInfo=""
            objectMessageAsJsonObject=""
            properties=""
            propertiesAsList=""
            stacktraceAsString="">
    <a-Serializer-implementation/>
    <KeyValuePair/><!-- multiple occurrences allowed -->
</JsonLayout>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

charset

Charset?

compact

boolean?

complete

boolean?

endOfLine

String?

eventEol

boolean?

footer

String?

header

String?

includeNullDelimiter

boolean?

Whether to include NULL byte as delimiter after each event (optional, default to false).

includeStacktrace

boolean?

If "true", includes the stacktrace of any Throwable in the generated JSON, defaults to "true".

If "true", includes the stacktrace of any Throwable in the generated data, defaults to "true".

includeTimeMillis

boolean?

Whether to include the timestamp (in addition to the Instant) (optional, default to false).

locationInfo

boolean?

objectMessageAsJsonObject

boolean?

properties

boolean?

propertiesAsList

boolean?

stacktraceAsString

boolean?

Whether to format the stacktrace as a string, and not a nested object (optional, defaults to false).

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Serializer?

KeyValuePair

KeyValuePair?

Additional fields to set on each log event.

LevelPatternSelector

Class

org.apache.logging.log4j.core.layout.LevelPatternSelector

Provider

org.apache.logging.log4j:log4j-core

Selects the pattern to use based on the Level in the LogEvent.

XML snippet
<LevelPatternSelector alwaysWriteExceptions=""
                      defaultPattern=""
                      disableAnsi=""
                      noConsoleNoAnsi="">
    <PatternMatch/><!-- multiple occurrences allowed -->
</LevelPatternSelector>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

alwaysWriteExceptions

boolean?

defaultPattern

String?

disableAnsi

boolean?

noConsoleNoAnsi

boolean?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

PatternMatch

PatternMatch?

LoggerFields

Class

org.apache.logging.log4j.core.layout.LoggerFields

Provider

org.apache.logging.log4j:log4j-core

A LoggerFields container.

XML snippet
<LoggerFields discardIfAllFieldsAreEmpty=""
              enterpriseId=""
              sdId="">
    <KeyValuePair/><!-- multiple occurrences allowed -->
</LoggerFields>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

discardIfAllFieldsAreEmpty

boolean?

this SD-ELEMENT should be discarded if all fields are empty

enterpriseId

String?

The IANA assigned enterprise number

sdId

String?

The SD-ID in an SD-ELEMENT

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

KeyValuePair

KeyValuePair?

An array of KeyValuePairs.

MarkerPatternSelector

Class

org.apache.logging.log4j.core.layout.MarkerPatternSelector

Provider

org.apache.logging.log4j:log4j-core

Selects the pattern to use based on the Marker in the LogEvent.

XML snippet
<MarkerPatternSelector alwaysWriteExceptions=""
                       defaultPattern=""
                       disableAnsi=""
                       noConsoleNoAnsi="">
    <PatternMatch/><!-- multiple occurrences allowed -->
</MarkerPatternSelector>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

alwaysWriteExceptions

boolean?

defaultPattern

String?

disableAnsi

boolean?

noConsoleNoAnsi

boolean?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

PatternMatch

PatternMatch?

MessageLayout

Class

org.apache.logging.log4j.core.layout.MessageLayout

Provider

org.apache.logging.log4j:log4j-core

Formats a org.apache.logging.log4j.core.LogEvent in its org.apache.logging.log4j.message.Message form.

Useful in combination with a JMS Appender to map a Log4j org.apache.logging.log4j.core.layout.org.apache.logging.log4j.message.MapMessage or org.apache.logging.log4j.core.layout.org.apache.logging.log4j.message.StringMapMessage to a JMS org.apache.logging.log4j.core.layout.javax.jms.MapMessage.

XML snippet
<MessageLayout/>

PatternLayout

Class

org.apache.logging.log4j.core.layout.PatternLayout

Provider

org.apache.logging.log4j:log4j-core

A flexible layout configurable with pattern string.

The goal of this class is to format a org.apache.logging.log4j.core.LogEvent and return the results. The format of the result depends on the conversion pattern.

The conversion pattern is closely related to the conversion pattern of the printf function in C. A conversion pattern is composed of literal text and format control expressions called conversion specifiers.

See the Log4j Manual for details on the supported pattern converters.

XML snippet
<PatternLayout alwaysWriteExceptions=""
               charset=""
               disableAnsi=""
               footer=""
               header=""
               noConsoleNoAnsi=""
               pattern="">
    <a-PatternSelector-implementation/>
    <Replace/>
</PatternLayout>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

alwaysWriteExceptions

boolean?

charset

Charset?

disableAnsi

boolean?

footer

String?

header

String?

noConsoleNoAnsi

boolean?

pattern

String?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

PatternSelector?

Replace

RegexReplacement?

PatternMatch

Class

org.apache.logging.log4j.core.layout.PatternMatch

Provider

org.apache.logging.log4j:log4j-core

PatternMatch configuration item.

XML snippet
<PatternMatch key=""
              pattern=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

key

String?

pattern

String?

PatternSelector

Class

org.apache.logging.log4j.core.layout.PatternSelector

Provider

org.apache.logging.log4j:log4j-core

Allows different patterns to be used with the PatternLayout based on some selection criteria.

Rfc5424Layout

Class

org.apache.logging.log4j.core.layout.Rfc5424Layout

Provider

org.apache.logging.log4j:log4j-core

Formats a log event in accordance with RFC 5424.

XML snippet
<Rfc5424Layout appName=""
               charset=""
               ein=""
               enterpriseNumber=""
               escapeNL=""
               eventPrefix=""
               exceptionPattern=""
               excludes=""
               facility=""
               footer=""
               header=""
               id=""
               includeMDC=""
               includeNL=""
               includes=""
               mdcId=""
               mdcPrefix=""
               messageId=""
               required=""
               useTLSMessageFormat="">
    <a-Serializer-implementation/>
    <LoggerFields/><!-- multiple occurrences allowed -->
</Rfc5424Layout>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

appName

String?

charset

Charset?

ein

String?

enterpriseNumber

Integer?

escapeNL

String?

eventPrefix

String?

exceptionPattern

String?

excludes

String?

facility

Facility?

footer

String?

header

String?

id

String?

includeMDC

boolean?

includeNL

boolean?

includes

String?

mdcId

String?

mdcPrefix

String?

messageId

String?

required

String?

useTLSMessageFormat

boolean?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Serializer?

LoggerFields

LoggerFields?

ScriptPatternSelector

Class

org.apache.logging.log4j.core.layout.ScriptPatternSelector

Provider

org.apache.logging.log4j:log4j-core

Selects the pattern to use based on the result of executing a Script.

The returned value will be used as the "key" to choose between one of the configured patterns. If no key is returned or there is no match the default pattern will be used.

XML snippet
<ScriptPatternSelector alwaysWriteExceptions=""
                       defaultPattern=""
                       disableAnsi=""
                       noConsoleNoAnsi="">
    <PatternMatch/><!-- multiple occurrences allowed -->
    <a-AbstractScript-implementation/>
</ScriptPatternSelector>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

alwaysWriteExceptions

boolean?

defaultPattern

String?

disableAnsi

boolean?

noConsoleNoAnsi

boolean?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

PatternMatch

PatternMatch?

AbstractScript?

SerializedLayout

Class

org.apache.logging.log4j.core.layout.SerializedLayout

Provider

org.apache.logging.log4j:log4j-core

Formats a org.apache.logging.log4j.core.LogEvent in its Java serialized form.

XML snippet
<SerializedLayout/>

SyslogLayout

Class

org.apache.logging.log4j.core.layout.SyslogLayout

Provider

org.apache.logging.log4j:log4j-core

Formats a log event as a BSD Log record.

XML snippet
<SyslogLayout charset=""
              facility=""
              footer=""
              header=""
              newLine=""
              newLineEscape="">
    <a-Serializer-implementation/>
</SyslogLayout>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

charset

Charset?

facility

Facility?

footer

String?

header

String?

newLine

boolean?

newLineEscape

String?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Serializer?

XmlLayout

Class

org.apache.logging.log4j.core.layout.XmlLayout

Provider

org.apache.logging.log4j:log4j-core

Appends a series of event elements as defined in the Log4j-events. xsd.

Additional Fields

If you configure complete="true", the appender outputs a well-formed XML document where the default namespace is the log4j namespace . By default, with complete="false", you should include the output as an external entity in a separate file to form a well-formed XML document.

If complete="false", the appender does not write the XML processing instruction and the root element.

Appenders using this layout should have their charset set to UTF-8 or UTF-16, otherwise events containing non-ASCII characters could result in corrupted log files.

By default, the XML layout is not compact (compact = not "pretty") with compact="false", which means the appender uses end-of-line characters and indents lines to format the XML. If compact="true", then no end-of-line or indentation is used. Message content may contain, of course, end-of-lines.

This property allows addition of custom fields into generated JSON. <XmlLayout><KeyValuePair key="foo" value="bar"/></XmlLayout> inserts <foo>bar</foo> directly into XML output. Supports Lookup expressions.

XML snippet
<XmlLayout charset=""
           compact=""
           complete=""
           endOfLine=""
           eventEol=""
           footer=""
           header=""
           includeNullDelimiter=""
           includeStacktrace=""
           includeTimeMillis=""
           locationInfo=""
           properties=""
           stacktraceAsString="">
    <a-Serializer-implementation/>
    <KeyValuePair/><!-- multiple occurrences allowed -->
</XmlLayout>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

charset

Charset?

compact

boolean?

complete

boolean?

endOfLine

String?

eventEol

boolean?

footer

String?

header

String?

includeNullDelimiter

boolean?

Whether to include NULL byte as delimiter after each event (optional, default to false).

includeStacktrace

boolean?

If "true", includes the stacktrace of any Throwable in the generated JSON, defaults to "true".

If "true", includes the stacktrace of any Throwable in the generated data, defaults to "true".

includeTimeMillis

boolean?

Whether to include the timestamp (in addition to the Instant) (optional, default to false).

locationInfo

boolean?

properties

boolean?

stacktraceAsString

boolean?

Whether to format the stacktrace as a string, and not a nested object (optional, defaults to false).

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Serializer?

KeyValuePair

KeyValuePair?

Additional fields to set on each log event.

YamlLayout

Class

org.apache.logging.log4j.core.layout.YamlLayout

Provider

org.apache.logging.log4j:log4j-core

Appends a series of YAML events as strings serialized as bytes.

Additional Fields

Appenders using this layout should have their charset set to UTF-8 or UTF-16, otherwise events containing non ASCII characters could result in corrupted log files.

This property allows addition of custom fields into generated JSON. <YamlLayout><KeyValuePair key="foo" value="bar"/></YamlLayout> inserts foo: "bar" directly into YAML output. Supports Lookup expressions.

XML snippet
<YamlLayout charset=""
            compact=""
            complete=""
            endOfLine=""
            eventEol=""
            footer=""
            header=""
            includeNullDelimiter=""
            includeStacktrace=""
            includeTimeMillis=""
            locationInfo=""
            properties=""
            stacktraceAsString="">
    <a-Serializer-implementation/>
    <KeyValuePair/><!-- multiple occurrences allowed -->
</YamlLayout>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

charset

Charset?

compact

boolean?

complete

boolean?

endOfLine

String?

eventEol

boolean?

footer

String?

header

String?

includeNullDelimiter

boolean?

Whether to include NULL byte as delimiter after each event (optional, default to false).

includeStacktrace

boolean?

If "true", includes the stacktrace of any Throwable in the generated JSON, defaults to "true".

If "true", includes the stacktrace of any Throwable in the generated data, defaults to "true".

includeTimeMillis

boolean?

Whether to include the timestamp (in addition to the Instant) (optional, default to false).

locationInfo

boolean?

properties

boolean?

stacktraceAsString

boolean?

Whether to format the stacktrace as a string, and not a nested object (optional, defaults to false).

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Serializer?

KeyValuePair

KeyValuePair?

Additional fields to set on each log event.

AbstractConfigurationAwareLookup

Class

org.apache.logging.log4j.core.lookup.AbstractConfigurationAwareLookup

Provider

org.apache.logging.log4j:log4j-core

StrLookup that is ConfigurationAware.

Handles saving the Configuration.

Known implementations

AbstractLookup

Class

org.apache.logging.log4j.core.lookup.AbstractLookup

Provider

org.apache.logging.log4j:log4j-core

A default lookup for others to extend.

ctx

Class

org.apache.logging.log4j.core.lookup.ContextMapLookup

Provider

org.apache.logging.log4j:log4j-core

Looks up keys from the context.

By default this is the org.apache.logging.log4j.ThreadContext, but users may configure a custom org.apache.logging.log4j.core.ContextDataInjector which obtains context data from some other source.

XML snippet
<ctx/>

date

Class

org.apache.logging.log4j.core.lookup.DateLookup

Provider

org.apache.logging.log4j:log4j-core

Formats the current date or the date in the LogEvent.

The "key" is used as the format String, following the java. text. SimpleDateFormat date and time pattern strings.

XML snippet
<date/>

env

Class

org.apache.logging.log4j.core.lookup.EnvironmentLookup

Provider

org.apache.logging.log4j:log4j-core

Looks up keys from environment variables.

XML snippet
<env/>

event

Class

org.apache.logging.log4j.core.lookup.EventLookup

Provider

org.apache.logging.log4j:log4j-core

Looks up values from the log event.

XML snippet
<event/>

java

Class

org.apache.logging.log4j.core.lookup.JavaLookup

Provider

org.apache.logging.log4j:log4j-core

Looks up keys related to Java: Java version, JRE version, VM version, and so on.

XML snippet
<java/>

jvmrunargs

Class

org.apache.logging.log4j.core.lookup.JmxRuntimeInputArgumentsLookup

Provider

org.apache.logging.log4j:log4j-core

Maps JVM input arguments (but not main arguments) using JMX to acquire JVM arguments.

XML snippet
<jvmrunargs/>

jndi

Class

org.apache.logging.log4j.core.lookup.JndiLookup

Provider

org.apache.logging.log4j:log4j-core

Looks up keys from JNDI resources.

XML snippet
<jndi/>

log4j

Class

org.apache.logging.log4j.core.lookup.Log4jLookup

Provider

org.apache.logging.log4j:log4j-core

Lookup properties of Log4j

XML snippet
<log4j/>

lower

Class

org.apache.logging.log4j.core.lookup.LowerLookup

Provider

org.apache.logging.log4j:log4j-core

Converts values to lower case.

The passed in "key" should be the value of another lookup.

XML snippet
<lower/>

main

Class

org.apache.logging.log4j.core.lookup.MainMapLookup

Provider

org.apache.logging.log4j:log4j-core

A map-based lookup for main arguments.

See MainMapLookup)[].

XML snippet
<main/>

map

Class

org.apache.logging.log4j.core.lookup.MapLookup

Provider

org.apache.logging.log4j:log4j-core

A map-based lookup.

XML snippet
<map/>

marker

Class

org.apache.logging.log4j.core.lookup.MarkerLookup

Provider

org.apache.logging.log4j:log4j-core

Looks-up markers.

XML snippet
<marker/>

bundle

Class

org.apache.logging.log4j.core.lookup.ResourceBundleLookup

Provider

org.apache.logging.log4j:log4j-core

Looks up keys from resource bundles.

XML snippet
<bundle/>

StrLookup

Class

org.apache.logging.log4j.core.lookup.StrLookup

Provider

org.apache.logging.log4j:log4j-core

Lookup a String key to a String value.

This class represents the simplest form of a string to string map. It has a benefit over a map in that it can create the result on demand based on the key.

This class comes complete with various factory methods. If these do not suffice, you can subclass and implement your own matcher.

For example, it would be possible to implement a lookup that used the key as a primary key, and looked up the value on demand from the database

sd

Class

org.apache.logging.log4j.core.lookup.StructuredDataLookup

Provider

org.apache.logging.log4j:log4j-core

Looks up keys from org.apache.logging.log4j.core.lookup.org.apache.logging.log4j.message.StructuredDataMessage log messages.

XML snippet
<sd/>

sys

Class

org.apache.logging.log4j.core.lookup.SystemPropertiesLookup

Provider

org.apache.logging.log4j:log4j-core

Looks up keys from system properties.

XML snippet
<sys/>

upper

Class

org.apache.logging.log4j.core.lookup.UpperLookup

Provider

org.apache.logging.log4j:log4j-core

Converts values to upper case.

The passed in "key" should be the value of another lookup.

XML snippet
<upper/>

Advertiser

Class

org.apache.logging.log4j.core.net.Advertiser

Provider

org.apache.logging.log4j:log4j-core

Facility

Class

org.apache.logging.log4j.core.net.Facility

Provider

org.apache.logging.log4j:log4j-core

The facility codes used by the Syslog system.

Numerical Code

Facility

Facility

0

kernel messages

1

user-level messages

2

mail system

3

system daemons

4

security/authorization messages

5

messages generated internally by syslogd

6

line printer subsystem

7

network news subsystem

8

UUCP subsystem

9

clock daemon

10

security/authorization messages

11

FTP daemon

12

NTP subsystem

13

log audit

14

log alert

15

clock daemon (note 2)

16

local use 0 (local0)

17

local use 1 (local1)

18

local use 2 (local2)

19

local use 3 (local3)

20

local use 4 (local4)

21

local use 5 (local5)

22

local use 6 (local6)

23

MulticastDns

Class

org.apache.logging.log4j.core.net.MulticastDnsAdvertiser

Provider

org.apache.logging.log4j:log4j-core

Advertise an entity via ZeroConf/MulticastDNS and the JmDNS library.

The length of property names and values must be 255 bytes or less. Entries with names or values larger than 255 bytes will be removed prior to advertisement.

XML snippet
<MulticastDns/>

Protocol

Class

org.apache.logging.log4j.core.net.Protocol

Provider

org.apache.logging.log4j:log4j-core

Enumerates the supported protocols.

Rfc1349TrafficClass

Class

org.apache.logging.log4j.core.net.Rfc1349TrafficClass

Provider

org.apache.logging.log4j:log4j-core

Enumerates the RFC 1349 TOS field.

  • IPTOS_LOWCOST (0x02)

  • IPTOS_RELIABILITY (0x04)

  • IPTOS_THROUGHPUT (0x08)

  • IPTOS_LOWDELAY (0x10) *

SocketAddress

Class

org.apache.logging.log4j.core.net.SocketAddress

Provider

org.apache.logging.log4j:log4j-core

Plugin to hold a hostname and port (socket address).

XML snippet
<SocketAddress host=""
               port=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

host

InetAddress?

port

int?

SocketOptions

Class

org.apache.logging.log4j.core.net.SocketOptions

Provider

org.apache.logging.log4j:log4j-core

Holds all socket options settable via java.net.Socket methods.

XML snippet
<SocketOptions keepAlive=""
               oobInline=""
               receiveBufferSize=""
               reuseAddress=""
               rfc1349TrafficClass=""
               sendBufferSize=""
               soLinger=""
               soTimeout=""
               tcpNoDelay=""
               trafficClass="">
    <SocketPerformancePreferences/>
</SocketOptions>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

keepAlive

Boolean?

See java.net.Socket#setKeepAlive(boolean).

See java.net.Socket#setKeepAlive(boolean).

oobInline

Boolean?

See java.net.Socket#setOOBInline(boolean).

See java.net.Socket#setOOBInline(boolean).

receiveBufferSize

Integer?

See java.net.Socket#setReceiveBufferSize(int).

See java.net.Socket#setReceiveBufferSize(int).

reuseAddress

Boolean?

See java.net.Socket#setReuseAddress(boolean).

See java.net.Socket#setReuseAddress(boolean).

rfc1349TrafficClass

Rfc1349TrafficClass?

See java.net.Socket#setTrafficClass(int).

See java.net.Socket#setTrafficClass(int).

sendBufferSize

Integer?

See java.net.Socket#setSendBufferSize(int).

See java.net.Socket#setSendBufferSize(int).

soLinger

Integer?

See java.net.Socket#setSoLinger(boolean,int).

See java.net.Socket#setSoLinger(boolean,int).

soTimeout

Integer?

See java.net.Socket#setSoTimeout(int).

See java.net.Socket#setSoTimeout(int).

tcpNoDelay

Boolean?

See java.net.Socket#setTcpNoDelay(boolean).

See java.net.Socket#setTcpNoDelay(boolean).

trafficClass

Integer?

See java.net.Socket#setTrafficClass(int).

See java.net.Socket#setTrafficClass(int).

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

SocketPerformancePreferences

SocketPerformancePreferences?

See java.net.Socket#setPerformancePreferences(int,int,int).

See java.net.Socket#setPerformancePreferences(int,int,int).

SocketPerformancePreferences

Class

org.apache.logging.log4j.core.net.SocketPerformancePreferences

Provider

org.apache.logging.log4j:log4j-core

Holds all socket options settable via java.net.Socket#setPerformancePreferences(int,int,int).

The java.net.Socket#setPerformancePreferences(int,int,int) API may not be implemented by a JRE.

XML snippet
<SocketPerformancePreferences bandwidth=""
                              connectionTime=""
                              latency=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

bandwidth

int

connectionTime

int

latency

int

AbstractKeyStoreConfiguration

Class

org.apache.logging.log4j.core.net.ssl.AbstractKeyStoreConfiguration

Provider

org.apache.logging.log4j:log4j-core

Configuration of the KeyStore

KeyStore

Class

org.apache.logging.log4j.core.net.ssl.KeyStoreConfiguration

Provider

org.apache.logging.log4j:log4j-core

Configuration of the KeyStore

XML snippet
<KeyStore keyManagerFactoryAlgorithm=""
          location=""
          password=""
          passwordEnvironmentVariable=""
          passwordFile=""
          type=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

keyManagerFactoryAlgorithm

String?

The standard name of the requested algorithm. See the Java Secure Socket Extension Reference Guide for information about these names.

location

String?

The location of the KeyStore, a file path, URL or resource.

password

String?

The password to access the KeyStore.

passwordEnvironmentVariable

String?

passwordFile

String?

type

String?

The KeyStore type, null defaults to "JKS".

Ssl

Class

org.apache.logging.log4j.core.net.ssl.SslConfiguration

Provider

org.apache.logging.log4j:log4j-core

SSL Configuration

XML snippet
<Ssl protocol="">
    <KeyStore/>
    <TrustStore/>
</Ssl>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

protocol

String?

The protocol, see SSLContext Algorithms

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

KeyStore

KeyStoreConfiguration?

The KeyStoreConfiguration.

TrustStore

TrustStoreConfiguration?

The TrustStoreConfiguration.

StoreConfiguration

Class

org.apache.logging.log4j.core.net.ssl.StoreConfiguration

Provider

org.apache.logging.log4j:log4j-core

TrustStore

Class

org.apache.logging.log4j.core.net.ssl.TrustStoreConfiguration

Provider

org.apache.logging.log4j:log4j-core

Configuration of the TrustStore

XML snippet
<TrustStore location=""
            password=""
            passwordEnvironmentVariable=""
            passwordFile=""
            trustManagerFactoryAlgorithm=""
            type=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

location

String?

The location of the KeyStore, a file path, URL or resource.

password

String?

The password to access the KeyStore.

passwordEnvironmentVariable

String?

passwordFile

String?

trustManagerFactoryAlgorithm

String?

The standard name of the requested trust management algorithm. See the Java Secure Socket Extension Reference Guide for information these names.

type

String?

The KeyStore type, null defaults to "JKS".

AbstractPatternConverter

Class

org.apache.logging.log4j.core.pattern.AbstractPatternConverter

Provider

org.apache.logging.log4j:log4j-core

AbstractPatternConverter is an abstract class that provides the formatting functionality that derived classes need.

Conversion specifiers in a conversion patterns are parsed to individual PatternConverters. Each of which is responsible for converting an object in a converter specific manner.

AbstractStyleNameConverter

Class

org.apache.logging.log4j.core.pattern.AbstractStyleNameConverter

Provider

org.apache.logging.log4j:log4j-core

Style pattern converter.

Adds ANSI color styling to the result of the enclosed pattern.

Known implementations

black

Class

org.apache.logging.log4j.core.pattern.AbstractStyleNameConverter.Black

Provider

org.apache.logging.log4j:log4j-core

Black style pattern converter.

Adds ANSI color styling to the result of the enclosed pattern.

XML snippet
<black/>

blue

Class

org.apache.logging.log4j.core.pattern.AbstractStyleNameConverter.Blue

Provider

org.apache.logging.log4j:log4j-core

Blue style pattern converter.

Adds ANSI color styling to the result of the enclosed pattern.

XML snippet
<blue/>

cyan

Class

org.apache.logging.log4j.core.pattern.AbstractStyleNameConverter.Cyan

Provider

org.apache.logging.log4j:log4j-core

Cyan style pattern converter.

Adds ANSI color styling to the result of the enclosed pattern.

XML snippet
<cyan/>

green

Class

org.apache.logging.log4j.core.pattern.AbstractStyleNameConverter.Green

Provider

org.apache.logging.log4j:log4j-core

Green style pattern converter.

Adds ANSI color styling to the result of the enclosed pattern.

XML snippet
<green/>

magenta

Class

org.apache.logging.log4j.core.pattern.AbstractStyleNameConverter.Magenta

Provider

org.apache.logging.log4j:log4j-core

Magenta style pattern converter.

Adds ANSI color styling to the result of the enclosed pattern.

XML snippet
<magenta/>

red

Class

org.apache.logging.log4j.core.pattern.AbstractStyleNameConverter.Red

Provider

org.apache.logging.log4j:log4j-core

Red style pattern converter.

Adds ANSI color styling to the result of the enclosed pattern.

XML snippet
<red/>

white

Class

org.apache.logging.log4j.core.pattern.AbstractStyleNameConverter.White

Provider

org.apache.logging.log4j:log4j-core

White style pattern converter.

Adds ANSI color styling to the result of the enclosed pattern.

XML snippet
<white/>

yellow

Class

org.apache.logging.log4j.core.pattern.AbstractStyleNameConverter.Yellow

Provider

org.apache.logging.log4j:log4j-core

Yellow style pattern converter.

Adds ANSI color styling to the result of the enclosed pattern.

XML snippet
<yellow/>

AnsiConverter

Class

org.apache.logging.log4j.core.pattern.AnsiConverter

Provider

org.apache.logging.log4j:log4j-core

Marks classes that implement ANSI escape code conversions.

Known implementations

ArrayPatternConverter

Class

org.apache.logging.log4j.core.pattern.ArrayPatternConverter

Provider

org.apache.logging.log4j:log4j-core

PatternConverters implement this interface to accept an array of objects when formatting.

ClassNamePatternConverter

Class

org.apache.logging.log4j.core.pattern.ClassNamePatternConverter

Provider

org.apache.logging.log4j:log4j-core

Formats the class name of the site of the logging request.

XML snippet
<ClassNamePatternConverter/>

DatePatternConverter

Class

org.apache.logging.log4j.core.pattern.DatePatternConverter

Provider

org.apache.logging.log4j:log4j-core

Converts and formats the event’s date in a StringBuilder.

XML snippet
<DatePatternConverter/>

encode

Class

org.apache.logging.log4j.core.pattern.EncodingPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Converter that encodes the output from a pattern using a specified format.

Supported formats include HTML (default) and JSON.

XML snippet
<encode/>

EndOfBatchPatternConverter

Class

org.apache.logging.log4j.core.pattern.EndOfBatchPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Formats the EndOfBatch.

XML snippet
<EndOfBatchPatternConverter/>

EqualsBaseReplacementConverter

Class

org.apache.logging.log4j.core.pattern.EqualsBaseReplacementConverter

Provider

org.apache.logging.log4j:log4j-core

Equals pattern converter.

equalsIgnoreCase

Class

org.apache.logging.log4j.core.pattern.EqualsIgnoreCaseReplacementConverter

Provider

org.apache.logging.log4j:log4j-core

Equals ignore case pattern converter.

XML snippet
<equalsIgnoreCase/>

equals

Class

org.apache.logging.log4j.core.pattern.EqualsReplacementConverter

Provider

org.apache.logging.log4j:log4j-core

Equals pattern converter.

XML snippet
<equals/>

ExtendedThrowablePatternConverter

Class

org.apache.logging.log4j.core.pattern.ExtendedThrowablePatternConverter

Provider

org.apache.logging.log4j:log4j-core

ThrowablePatternConverter variant where the rendered java.lang.StackTraceElements are enriched with the enclosing JAR file and its version information, if available.

XML snippet
<ExtendedThrowablePatternConverter/>

FileDatePatternConverter

Class

org.apache.logging.log4j.core.pattern.FileDatePatternConverter

Provider

org.apache.logging.log4j:log4j-core

Formats a date by delegating to DatePatternConverter.

The default date pattern for a %d specifier in a file name is different than the %d pattern in pattern layout.

XML snippet
<FileDatePatternConverter/>

FileLocationPatternConverter

Class

org.apache.logging.log4j.core.pattern.FileLocationPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Returns the event’s line location information in a StringBuilder.

XML snippet
<FileLocationPatternConverter/>

FullLocationPatternConverter

Class

org.apache.logging.log4j.core.pattern.FullLocationPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Format the event’s line location information.

XML snippet
<FullLocationPatternConverter/>

highlight

Class

org.apache.logging.log4j.core.pattern.HighlightConverter

Provider

org.apache.logging.log4j:log4j-core

Highlight pattern converter.

Formats the result of a pattern using a color appropriate for the Level in the LogEvent.

For example:

%highlight{%d{ ISO8601 } [%t] %-5level: %msg%n%throwable}

You can define custom colors for each Level:

%highlight{%d{ ISO8601 } [%t] %-5level: %msg%n%throwable}{FATAL=red, ERROR=red, WARN=yellow, INFO=green, DEBUG=cyan,
TRACE=black}

You can use a predefined style:

%highlight{%d{ ISO8601 } [%t] %-5level: %msg%n%throwable}{STYLE=DEFAULT}

The available predefined styles are:

  • Default

  • Log4j - The same as Default

  • Logback

You can use whitespace around the comma and equal sign. The names in values MUST come from the org.apache.logging.log4j.core.pattern.AnsiEscape enum, case is normalized to upper-case internally.

To disable ANSI output unconditionally, specify an additional option disableAnsi=true, or to disable ANSI output if no console is detected, specify option noConsoleNoAnsi=true e.g..

%highlight{%d{ ISO8601 } [%t] %-5level: %msg%n%throwable}{STYLE=DEFAULT, noConsoleNoAnsi=true}
XML snippet
<highlight/>

IntegerPatternConverter

Class

org.apache.logging.log4j.core.pattern.IntegerPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Formats an integer.

XML snippet
<IntegerPatternConverter/>

LevelPatternConverter

Class

org.apache.logging.log4j.core.pattern.LevelPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Returns the event’s level in a StringBuilder.

XML snippet
<LevelPatternConverter/>

LineLocationPatternConverter

Class

org.apache.logging.log4j.core.pattern.LineLocationPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Returns the event’s line location information in a StringBuilder.

XML snippet
<LineLocationPatternConverter/>

LineSeparatorPatternConverter

Class

org.apache.logging.log4j.core.pattern.LineSeparatorPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Formats a line separator.

XML snippet
<LineSeparatorPatternConverter/>

LoggerFqcnPatternConverter

Class

org.apache.logging.log4j.core.pattern.LoggerFqcnPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Formats the Logger FQCN.

XML snippet
<LoggerFqcnPatternConverter/>

LoggerPatternConverter

Class

org.apache.logging.log4j.core.pattern.LoggerPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Formats a logger name.

XML snippet
<LoggerPatternConverter/>

MapPatternConverter

Class

org.apache.logging.log4j.core.pattern.MapPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Able to handle the contents of the LogEvent’s MapMessage and either output the entire contents of the properties in a similar format to the java. util. Hashtable. toString(), or to output the value of a specific key within the Map.

XML snippet
<MapPatternConverter/>

MarkerPatternConverter

Class

org.apache.logging.log4j.core.pattern.MarkerPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Returns events' full marker string in a StringBuilder.

XML snippet
<MarkerPatternConverter/>

MarkerNamePatternConverter

Class

org.apache.logging.log4j.core.pattern.MarkerSimpleNamePatternConverter

Provider

org.apache.logging.log4j:log4j-core

Appends an event’s maker name to a StringBuilder.

XML snippet
<MarkerNamePatternConverter/>

maxLength

Class

org.apache.logging.log4j.core.pattern.MaxLengthConverter

Provider

org.apache.logging.log4j:log4j-core

Max length pattern converter.

Limit contained text to a maximum length. On invalid length the default value 100 is used (and an error message is logged). If max length is greater than 20, an abbreviated text will get ellipsis ("…​") appended. Example usage (for email subject):

`%maxLen{[AppName, ${hostName}, ${web:contextPath}] %p: %c{1} - %m%notEmpty{ =>%ex{short}}}{160}`
XML snippet
<maxLength/>

MdcPatternConverter

Class

org.apache.logging.log4j.core.pattern.MdcPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Able to handle the contents of the LogEvent’s MDC and either output the entire contents of the properties in a similar format to the java. util. Hashtable. toString(), or to output the value of a specific key within the property bundle when this pattern converter has the option set.

XML snippet
<MdcPatternConverter/>

MessagePatternConverter

Class

org.apache.logging.log4j.core.pattern.MessagePatternConverter

Provider

org.apache.logging.log4j:log4j-core

Returns the event’s rendered message in a StringBuilder.

XML snippet
<MessagePatternConverter/>

MethodLocationPatternConverter

Class

org.apache.logging.log4j.core.pattern.MethodLocationPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Returns the event’s line location information in a StringBuilder.

XML snippet
<MethodLocationPatternConverter/>

NamePatternConverter

Class

org.apache.logging.log4j.core.pattern.NamePatternConverter

Provider

org.apache.logging.log4j:log4j-core

Abstract base class for other pattern converters which can return only parts of their name.

NanoTimePatternConverter

Class

org.apache.logging.log4j.core.pattern.NanoTimePatternConverter

Provider

org.apache.logging.log4j:log4j-core

Converts and formats the event’s nanoTime in a StringBuilder.

XML snippet
<NanoTimePatternConverter/>

NdcPatternConverter

Class

org.apache.logging.log4j.core.pattern.NdcPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Returns the event’s NDC in a StringBuilder.

XML snippet
<NdcPatternConverter/>

ProcessIdPatternConverter

Class

org.apache.logging.log4j.core.pattern.ProcessIdPatternConverter

Provider

org.apache.logging.log4j:log4j-core

XML snippet
<ProcessIdPatternConverter/>

Replace

Class

org.apache.logging.log4j.core.pattern.RegexReplacement

Provider

org.apache.logging.log4j:log4j-core

Replace tokens in the LogEvent message.

XML snippet
<Replace regex=""
         replacement=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

regex

Pattern?

The regular expression to locate.

replacement

String?

The replacement value.

replace

Class

org.apache.logging.log4j.core.pattern.RegexReplacementConverter

Provider

org.apache.logging.log4j:log4j-core

Replacement pattern converter.

XML snippet
<replace/>

RelativeTimePatternConverter

Class

org.apache.logging.log4j.core.pattern.RelativeTimePatternConverter

Provider

org.apache.logging.log4j:log4j-core

Returns the relative time in milliseconds since JVM Startup.

XML snippet
<RelativeTimePatternConverter/>

repeat

Class

org.apache.logging.log4j.core.pattern.RepeatPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Equals pattern converter.

XML snippet
<repeat/>

RootThrowablePatternConverter

Class

org.apache.logging.log4j.core.pattern.RootThrowablePatternConverter

Provider

org.apache.logging.log4j:log4j-core

ThrowablePatternConverter variant where the stack trace causal chain is rendered in reverse order.

XML snippet
<RootThrowablePatternConverter/>

SequenceNumberPatternConverter

Class

org.apache.logging.log4j.core.pattern.SequenceNumberPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Formats the event sequence number.

XML snippet
<SequenceNumberPatternConverter/>

style

Class

org.apache.logging.log4j.core.pattern.StyleConverter

Provider

org.apache.logging.log4j:log4j-core

Style pattern converter.

Adds ANSI color styling to the result of the enclosed pattern.

To disable ANSI output unconditionally, specify an additional option disableAnsi=true, or to disable ANSI output if no console is detected, specify option noConsoleNoAnsi=true.

XML snippet
<style/>

ThreadIdPatternConverter

Class

org.apache.logging.log4j.core.pattern.ThreadIdPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Formats the event thread ID.

XML snippet
<ThreadIdPatternConverter/>

ThreadPatternConverter

Class

org.apache.logging.log4j.core.pattern.ThreadNamePatternConverter

Provider

org.apache.logging.log4j:log4j-core

Formats the event thread name.

XML snippet
<ThreadPatternConverter/>

ThreadPriorityPatternConverter

Class

org.apache.logging.log4j.core.pattern.ThreadPriorityPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Formats the event thread priority.

XML snippet
<ThreadPriorityPatternConverter/>

ThrowablePatternConverter

Class

org.apache.logging.log4j.core.pattern.ThrowablePatternConverter

Provider

org.apache.logging.log4j:log4j-core

Outputs certain information extracted from the java.lang.Throwable associated with a org.apache.logging.log4j.core.LogEvent.

XML snippet
<ThrowablePatternConverter/>

UuidPatternConverter

Class

org.apache.logging.log4j.core.pattern.UuidPatternConverter

Provider

org.apache.logging.log4j:log4j-core

Formats the event sequence number.

XML snippet
<UuidPatternConverter/>

notEmpty

Class

org.apache.logging.log4j.core.pattern.VariablesNotEmptyReplacementConverter

Provider

org.apache.logging.log4j:log4j-core

VariablesNotEmpty pattern converter.

XML snippet
<notEmpty/>

AbstractScript

Class

org.apache.logging.log4j.core.script.AbstractScript

Provider

org.apache.logging.log4j:log4j-core

Container for the language and body of a script.

Known implementations

Script

Class

org.apache.logging.log4j.core.script.Script

Provider

org.apache.logging.log4j:log4j-core

Container for the language and body of a script.

XML snippet
<Script language=""
        name=""
        scriptText=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

language

String?

name

String?

scriptText

String?

ScriptFile

Class

org.apache.logging.log4j.core.script.ScriptFile

Provider

org.apache.logging.log4j:log4j-core

Container for the language and body of a script file along with the file location.

XML snippet
<ScriptFile charset=""
            isWatched=""
            language=""
            name=""
            path=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

charset

Charset?

isWatched

Boolean?

language

String?

name

String?

path

String?

ScriptRef

Class

org.apache.logging.log4j.core.script.ScriptRef

Provider

org.apache.logging.log4j:log4j-core

Contains a reference to a script defined elsewhere in the configuration.

XML snippet
<ScriptRef ref=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

ref

String?

AbstractWatcher

Class

org.apache.logging.log4j.core.util.AbstractWatcher

Provider

org.apache.logging.log4j:log4j-core

Watcher for configuration files.

Causes a reconfiguration when a file changes.

Known implementations

Builder

Class

org.apache.logging.log4j.core.util.Builder

Provider

org.apache.logging.log4j:log4j-core

A type of builder that can be used to configure and create a instances using a Java DSL instead of through a configuration file.

These builders are primarily useful for internal code and unit tests, but they can technically be used as a verbose alternative to configuration files.

When creating plugin builders, it is customary to create the builder class as a public static inner class called Builder. For instance, the builder class for PatternLayout would be PatternLayout. Builder.

KeyValuePair

Class

org.apache.logging.log4j.core.util.KeyValuePair

Provider

org.apache.logging.log4j:log4j-core

Key/Value pair configuration item.

XML snippet
<KeyValuePair key=""
              value=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

key

String?

value

String?

Watcher

Class

org.apache.logging.log4j.core.util.Watcher

Provider

org.apache.logging.log4j:log4j-core

Watches for changes in a Source and performs an action when it is modified.

Known implementations

log4j-couchdb

NoSqlProvider

Class

org.apache.logging.log4j.core.appender.nosql.NoSqlProvider

Provider

org.apache.logging.log4j:log4j-couchdb

CouchDB

Class

org.apache.logging.log4j.couchdb.CouchDbProvider

Provider

org.apache.logging.log4j:log4j-couchdb

The Apache CouchDB implementation of NoSqlProvider.

XML snippet
<CouchDB databaseName=""
         factoryClassName=""
         factoryMethodName=""
         password=""
         port=""
         protocol=""
         server=""
         username=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

databaseName

String?

The name of the database to which log event documents will be written.

factoryClassName

String?

A fully qualified class name containing a static factory method capable of returning a org.lightcouch.CouchDbClient or org.lightcouch.CouchDbProperties.

factoryMethodName

String?

The name of the public static factory method belonging to the aforementioned factory class.

password

String?

The password to authenticate against the MongoDB server with, mutually exclusive with factoryClassName&factoryMethodName! =null.

port

String?

The port that CouchDB is listening on, defaults to 80 if protocol is "http" and 443 if protocol is "https," and mutually exclusive with factoryClassName&factoryMethodName! =null.

protocol

String?

Either "http" or "https," defaults to "http" and mutually exclusive with factoryClassName&factoryMethodName! =null.

server

String?

The host name of the CouchDB server, defaults to localhost and mutually exclusive with factoryClassName&factoryMethodName! =null.

username

String?

The username to authenticate against the MongoDB server with, mutually exclusive with factoryClassName&factoryMethodName! =null.

log4j-docker

docker

Class

org.apache.logging.log4j.docker.DockerLookup

Provider

org.apache.logging.log4j:log4j-docker

Lookups up keys for a Docker container.

XML snippet
<docker/>

log4j-jdbc-dbcp2

PoolableConnectionFactory

Class

org.apache.logging.log4j.core.appender.db.jdbc.PoolableConnectionFactoryConfig

Provider

org.apache.logging.log4j:log4j-jdbc-dbcp2

Configures an Apache Commons DBCP org.apache.commons.dbcp2.PoolableConnectionFactory.

XML snippet
<PoolableConnectionFactory autoCommitOnReturn=""
                           cacheState=""
                           defaultAutoCommit=""
                           defaultCatalog=""
                           defaultQueryTimeoutSeconds=""
                           defaultReadOnly=""
                           defaultTransactionIsolation=""
                           fastFailValidation=""
                           maxConnLifetimeMillis=""
                           maxOpenPreparedStatements=""
                           poolStatements=""
                           rollbackOnReturn=""
                           validationQuery=""
                           validationQueryTimeoutSeconds="">
    <a-String-implementation/><!-- multiple occurrences allowed -->
</PoolableConnectionFactory>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

autoCommitOnReturn

boolean?

cacheState

boolean?

defaultAutoCommit

Boolean?

defaultCatalog

String?

defaultQueryTimeoutSeconds

Integer?

defaultReadOnly

Boolean?

defaultTransactionIsolation

int?

fastFailValidation

boolean?

maxConnLifetimeMillis

long?

maxOpenPreparedStatements

int?

poolStatements

boolean?

rollbackOnReturn

boolean?

validationQuery

String?

validationQueryTimeoutSeconds

int?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

String?

PoolingDriver

Class

org.apache.logging.log4j.core.appender.db.jdbc.PoolingDriverConnectionSource

Provider

org.apache.logging.log4j:log4j-jdbc-dbcp2

A ConnectionSource that uses a JDBC connection string, a user name, and a password to call java.sql.DriverManager#getConnection(String,String,String).

The connections are served from an Apache Commons DBCP pooling driver.

XML snippet
<PoolingDriver connectionString=""
               driverClassName=""
               password=""
               poolName=""
               userName="">
    <PoolableConnectionFactory/>
    <Property/><!-- multiple occurrences allowed -->
</PoolingDriver>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

connectionString

String

driverClassName

String?

password

String?

poolName

String?

userName

String?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

PoolableConnectionFactory

PoolableConnectionFactoryConfig?

Property

Property?

log4j-jpa

JPA

Class

org.apache.logging.log4j.core.appender.db.jpa.JpaAppender

Provider

org.apache.logging.log4j:log4j-jpa

This Appender writes logging events to a relational database using the Java Persistence API.

It requires a pre-configured JPA persistence unit and a concrete implementation of the abstract org.apache.logging.log4j.core.appender.db.jpa.AbstractLogEventWrapperEntity class decorated with JPA annotations.

XML snippet
<JPA bufferSize=""
     entityClassName=""
     ignoreExceptions=""
     name=""
     persistenceUnitName="">
    <a-Filter-implementation/>
</JPA>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

bufferSize

String?

If an integer greater than 0, this causes the appender to buffer log events and flush whenever the buffer reaches this size.

entityClassName

String?

The fully qualified name of the concrete org.apache.logging.log4j.core.appender.db.jpa.AbstractLogEventWrapperEntity implementation that has JPA annotations mapping it to a database table.

ignoreExceptions

String?

If "true" (default) exceptions encountered when appending events are logged; otherwise they are propagated to the caller.

name

String?

The name of the appender.

persistenceUnitName

String?

The name of the JPA persistence unit that should be used for persisting log events.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Filter?

The filter, if any, to use.

log4j-layout-template-json

JsonTemplateLayout

Class

org.apache.logging.log4j.layout.template.json.JsonTemplateLayout

Provider

org.apache.logging.log4j:log4j-layout-template-json

XML snippet
<JsonTemplateLayout charset=""
                    eventDelimiter=""
                    eventTemplate=""
                    eventTemplateRootObjectKey=""
                    eventTemplateUri=""
                    locationInfoEnabled=""
                    maxStringLength=""
                    nullEventDelimiterEnabled=""
                    recyclerFactory=""
                    stackTraceElementTemplate=""
                    stackTraceElementTemplateUri=""
                    stackTraceEnabled=""
                    truncatedStringSuffix="">
    <EventTemplateAdditionalField/><!-- multiple occurrences allowed -->
</JsonTemplateLayout>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

charset

Charset?

eventDelimiter

String?

eventTemplate

String?

eventTemplateRootObjectKey

String?

eventTemplateUri

String?

locationInfoEnabled

boolean?

maxStringLength

int?

nullEventDelimiterEnabled

boolean?

recyclerFactory

RecyclerFactory?

stackTraceElementTemplate

String?

stackTraceElementTemplateUri

String?

stackTraceEnabled

boolean?

truncatedStringSuffix

String?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

EventTemplateAdditionalField

EventTemplateAdditionalField?

EventTemplateAdditionalField

Class

org.apache.logging.log4j.layout.template.json.JsonTemplateLayout.EventTemplateAdditionalField

Provider

org.apache.logging.log4j:log4j-layout-template-json

XML snippet
<EventTemplateAdditionalField format=""
                              key=""
                              value=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

format

Format?

key

String?

value

String?

Format

Class

org.apache.logging.log4j.layout.template.json.JsonTemplateLayout.EventTemplateAdditionalField.Format

Provider

org.apache.logging.log4j:log4j-layout-template-json

CaseConverterResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.CaseConverterResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.CaseConverterResolver factory.

XML snippet
<CaseConverterResolverFactory/>

CounterResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.CounterResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.CounterResolver factory.

XML snippet
<CounterResolverFactory/>

EndOfBatchResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.EndOfBatchResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.EndOfBatchResolver factory.

XML snippet
<EndOfBatchResolverFactory/>

EventAdditionalFieldInterceptor

Class

org.apache.logging.log4j.layout.template.json.resolver.EventAdditionalFieldInterceptor

Provider

org.apache.logging.log4j:log4j-layout-template-json

Interceptor to add additional fields after event template read.

XML snippet
<EventAdditionalFieldInterceptor/>

EventResolverInterceptor

Class

org.apache.logging.log4j.layout.template.json.resolver.EventResolverInterceptor

Provider

org.apache.logging.log4j:log4j-layout-template-json

TemplateResolverInterceptor specialized for org.apache.logging.log4j.core.LogEvents.

EventRootObjectKeyInterceptor

Class

org.apache.logging.log4j.layout.template.json.resolver.EventRootObjectKeyInterceptor

Provider

org.apache.logging.log4j:log4j-layout-template-json

Interceptor to add a root object key to the event template.

XML snippet
<EventRootObjectKeyInterceptor/>

ExceptionResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.ExceptionResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.ExceptionResolver factory.

XML snippet
<ExceptionResolverFactory/>

ExceptionRootCauseResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.ExceptionRootCauseResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.ExceptionRootCauseResolver factory.

XML snippet
<ExceptionRootCauseResolverFactory/>

LevelResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.LevelResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.LevelResolver factory.

XML snippet
<LevelResolverFactory/>

LoggerResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.LoggerResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.LoggerResolver factory.

XML snippet
<LoggerResolverFactory/>

MainMapResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.MainMapResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.MainMapResolver factory.

XML snippet
<MainMapResolverFactory/>

MapResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.MapResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.MapResolver factory.

XML snippet
<MapResolverFactory/>

MarkerResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.MarkerResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.MarkerResolver factory.

XML snippet
<MarkerResolverFactory/>

MessageParameterResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.MessageParameterResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.MessageParameterResolver factory.

XML snippet
<MessageParameterResolverFactory/>

MessageResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.MessageResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

A org.apache.logging.log4j.layout.template.json.resolver.MessageResolver factory.

XML snippet
<MessageResolverFactory/>

PatternResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.PatternResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.PatternResolver factory.

XML snippet
<PatternResolverFactory/>

SourceResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.SourceResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.SourceResolver factory.

XML snippet
<SourceResolverFactory/>

TemplateResolverInterceptor

Class

org.apache.logging.log4j.layout.template.json.resolver.TemplateResolverInterceptor

Provider

org.apache.logging.log4j:log4j-layout-template-json

Main org.apache.logging.log4j.layout.template.json.resolver.TemplateResolver compilation interception interface.

ThreadContextDataResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.ThreadContextDataResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.ThreadContextDataResolver factory.

XML snippet
<ThreadContextDataResolverFactory/>

ThreadContextStackResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.ThreadContextStackResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.ThreadContextStackResolver factory.

XML snippet
<ThreadContextStackResolverFactory/>

ThreadResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.ThreadResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.ThreadResolver factory.

XML snippet
<ThreadResolverFactory/>

TimestampResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.TimestampResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.TimestampResolver factory.

XML snippet
<TimestampResolverFactory/>

RecyclerFactory

Class

org.apache.logging.log4j.layout.template.json.util.RecyclerFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

RecyclerFactoryConverter

Class

org.apache.logging.log4j.layout.template.json.util.RecyclerFactoryConverter

Provider

org.apache.logging.log4j:log4j-layout-template-json

The default string (i.e., recycler factory spec) to RecyclerFactory type converter.

XML snippet
<RecyclerFactoryConverter/>

log4j-mongodb

MongoDb

Class

org.apache.logging.log4j.mongodb.MongoDbProvider

Provider

org.apache.logging.log4j:log4j-mongodb

Delegates to MongoDb4Provider under the name MongoDb.

XML snippet
<MongoDb capped=""
         collectionSize=""
         connection="">
    <a-Filter-implementation/>
    <Property/><!-- multiple occurrences allowed -->
</MongoDb>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

capped

boolean?

collectionSize

long?

connection

String

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

Filter?

log4j-mongodb4

MongoDb4

Class

org.apache.logging.log4j.mongodb4.MongoDb4Provider

Provider

org.apache.logging.log4j:log4j-mongodb4

The MongoDB implementation of NoSqlProvider using the MongoDB driver version 4 API.

XML snippet
<MongoDb4 capped=""
          collectionSize=""
          connection="">
    <a-Filter-implementation/>
    <Property/><!-- multiple occurrences allowed -->
</MongoDb4>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

capped

boolean?

Sets whether the MongoDB collection is capped.

collectionSize

long?

Sets the maximum size in bytes of a capped collection.

Sets the maximum size in bytes of a capped collection.

connection

String

Sets the MongoDB connection string.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

Filter?

log4j-spring-boot

LoggerContextAware

Class

org.apache.logging.log4j.core.config.LoggerContextAware

Provider

org.apache.logging.log4j:log4j-spring-boot

Known implementations

spring

Class

org.apache.logging.log4j.spring.boot.SpringLookup

Provider

org.apache.logging.log4j:log4j-spring-boot

Lookup for Spring properties.

XML snippet
<spring/>

SpringProfile

Class

org.apache.logging.log4j.spring.boot.SpringProfileArbiter

Provider

org.apache.logging.log4j:log4j-spring-boot

An Aribter that uses the active Spring profile to determine if configuration should be included.

XML snippet
<SpringProfile name=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

name

String?

Sets the Profile Name or Names.

log4j-web

web

Class

org.apache.logging.log4j.web.WebLookup

Provider

org.apache.logging.log4j:log4j-web

XML snippet
<web/>

Servlet

Class

org.apache.logging.log4j.web.appender.ServletAppender

Provider

org.apache.logging.log4j:log4j-web

Logs using the ServletContext’s log method

XML snippet
<Servlet ignoreExceptions=""
         logThrowables=""
         name="">
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <Property/><!-- multiple occurrences allowed -->
</Servlet>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

ignoreExceptions

boolean?

logThrowables

boolean?

Logs with javax.servlet.ServletContext#log(String,Throwable) if true and with javax.servlet.ServletContext#log(String) if false.

Logs with javax.servlet.ServletContext#log(String,Throwable) if true and with javax.servlet.ServletContext#log(String) if false.

name

String

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

Filter?

Layout?