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.

org.apache.logging.log4j:log4j-async-logger

AsyncLogger

Class

org.apache.logging.log4j.async.logger.AsyncLoggerConfig

Provider

org.apache.logging.log4j:log4j-async-logger

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=""
             loggerName="">
    <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?

loggerName

String?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

AppenderRef

AppenderRef?

Property

Property?

Filter?

AsyncRoot

Class

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

Provider

org.apache.logging.log4j:log4j-async-logger

An asynchronous root Logger.

XML snippet
<AsyncRoot 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

includeLocation

String?

level

Level?

levelAndRefs

String?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

AppenderRef

AppenderRef?

Property

Property?

Filter?

Disruptor

Class

org.apache.logging.log4j.async.logger.DisruptorConfiguration

Provider

org.apache.logging.log4j:log4j-async-logger

A container for:

  1. A user provided wait strategy factory.

  2. The common org.apache.logging.log4j.async.logger.AsyncLoggerConfigDisruptor instance shared by all logger configs.

TODO: the only reason the disruptor needs a holder is that org.apache.logging.log4j.async.logger.org.apache.logging.log4j.plugins.di.InstanceFactory is currently unable to stop the services it creates.

In the future the disruptor will be in the instance factory.

XML snippet
<Disruptor class=""
           waitFactory=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

class

String?

waitFactory

String?

org.apache.logging.log4j.core.config.ConfigurationExtension

Class

org.apache.logging.log4j.core.config.ConfigurationExtension

Provider

org.apache.logging.log4j:log4j-async-logger

Known implementations

org.apache.logging.log4j:log4j-compress

CommonsCompressActionFactoryProvider

Class

org.apache.logging.log4j.compress.commons.CommonsCompressActionFactoryProvider

Provider

org.apache.logging.log4j:log4j-compress

XML snippet
<CommonsCompressActionFactoryProvider/>

org.apache.logging.log4j:log4j-config-properties

JavaPropsConfigurationFactory

Class

org.apache.logging.log4j.config.properties.JavaPropsConfigurationFactory

Provider

org.apache.logging.log4j:log4j-config-properties

XML snippet
<JavaPropsConfigurationFactory/>

org.apache.logging.log4j:log4j-config-yaml

YamlConfigurationFactory

Class

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

Provider

org.apache.logging.log4j:log4j-config-yaml

XML snippet
<YamlConfigurationFactory/>

org.apache.logging.log4j:log4j-conversant

com.conversantmedia.util.concurrent.SpinPolicy

Class

com.conversantmedia.util.concurrent.SpinPolicy

Provider

org.apache.logging.log4j:log4j-conversant

DisruptorBlockingQueue

Class

org.apache.logging.log4j.conversant.DisruptorBlockingQueueFactory

Provider

org.apache.logging.log4j:log4j-conversant

A BlockingQueueFactory based on Conversant Disruptor BlockingQueue.

XML snippet
<DisruptorBlockingQueue spinPolicy=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

spinPolicy

SpinPolicy?

org.apache.logging.log4j:log4j-core

org.apache.logging.log4j.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.

org.apache.logging.log4j.core.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.org.apache.logging.log4j.plugins.Plugin and need to provide a static factory method annotated with org.apache.logging.log4j.core.org.apache.logging.log4j.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.

org.apache.logging.log4j.core.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.

org.apache.logging.log4j.core.Filter.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.

org.apache.logging.log4j.core.Layout

Class

org.apache.logging.log4j.core.Layout

Provider

org.apache.logging.log4j:log4j-core

Converts org.apache.logging.log4j.core.LogEvent instances into different layouts of data.

A layout typically encodes into either a java.lang.String or byte[]. Since version 2.6, layouts implement Encoder to support direct encoding of a log event into a org.apache.logging.log4j.core.layout.ByteBufferDestination without creating temporary intermediary objects. Since version 3.0.0, layouts no longer reference the legacy Java serialization API and are limited to strings or bytes.

org.apache.logging.log4j.core.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.

org.apache.logging.log4j.core.StringLayout

Class

org.apache.logging.log4j.core.StringLayout

Provider

org.apache.logging.log4j:log4j-core

Legacy interface from when layouts used to support more than strings or bytes.

org.apache.logging.log4j.core.appender.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.

org.apache.logging.log4j.core.appender.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.

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

Name of the appender to use in references

shutdownTimeout

long?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

BlockingQueueFactory?

AppenderRef

AppenderRef

Property

Property?

A generic list of key/value properties

The meaning of these properties depends on the component.

Filter?

If not null, applies the filter to all events passing through this component

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?

Determines whether to use a buffered OutputStream

If set to true (default) the appender will buffer messages before sending them. This attribute is ignored if immediateFlush is set to true.

bufferSize

int?

Size of the buffer in bytes

direct

boolean?

follow

boolean?

ignoreExceptions

boolean?

Determines whether to propagate logging exceptions

If set to true (default), exceptions that occur during logging will appear in the status logger.

If set to false, exceptions will be propagates to the caller.

immediateFlush

boolean?

Flushes the underlying OutputStream after each event

The effects of this setting depend on the output stream implementation (see java.io.OutputStream#flush(). In the case of files, for example, setting this attribute to true, guarantees that all bytes written are passed to the operating system, but it does not guarantee that they are actually written to a physical device.

Setting this to true automatically disables buffering.

name

String?

Name of the appender to use in references

target

Target

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

A generic list of key/value properties

The meaning of these properties depends on the component.

Filter?

If not null, applies the filter to all events passing through this component

Layout?

Formats the log events

org.apache.logging.log4j.core.appender.ConsoleAppender.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

boolean?

Determines whether to propagate logging exceptions

If set to true (default), exceptions that occur during logging will appear in the status logger.

If set to false, exceptions will be propagates to the caller.

name

String

The name of the Appender (required).

primary

String

The name of the primary Appender (required).

retryIntervalSeconds

int?

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?

Determines whether to use a buffered OutputStream

If set to true (default) the appender will buffer messages before sending them. This attribute is ignored if immediateFlush is set to true.

bufferSize

int?

Size of the buffer in bytes

createOnDemand

boolean?

fileGroup

String?

fileName

String

fileOwner

String?

filePermissions

String?

ignoreExceptions

boolean?

Determines whether to propagate logging exceptions

If set to true (default), exceptions that occur during logging will appear in the status logger.

If set to false, exceptions will be propagates to the caller.

immediateFlush

boolean?

Flushes the underlying OutputStream after each event

The effects of this setting depend on the output stream implementation (see org.apache.logging.log4j.core.appender.OutputStream#flush(). In the case of files, for example, setting this attribute to true, guarantees that all bytes written are passed to the operating system, but it does not guarantee that they are actually written to a physical device.

Setting this to true automatically disables buffering.

locking

boolean?

name

String?

Name of the appender to use in references

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

A generic list of key/value properties

The meaning of these properties depends on the component.

Filter?

If not null, applies the filter to all events passing through this component

Layout?

Formats the log events

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?

Determines whether to propagate logging exceptions

If set to true (default), exceptions that occur during logging will appear in the status logger.

If set to false, exceptions will be propagates to the caller.

method

String?

name

String?

Name of the appender to use in references

readTimeoutMillis

int?

url

URL

verifyHostname

boolean?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

A generic list of key/value properties

The meaning of these properties depends on the component.

Filter?

If not null, applies the filter to all events passing through this component

Layout?

Formats the log events

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?

Determines whether to use a buffered OutputStream

If set to true (default) the appender will buffer messages before sending them. This attribute is ignored if immediateFlush is set to true.

bufferSize

int?

Size of the buffer in bytes

fileName

String?

ignoreExceptions

boolean?

Determines whether to propagate logging exceptions

If set to true (default), exceptions that occur during logging will appear in the status logger.

If set to false, exceptions will be propagates to the caller.

immediateFlush

boolean?

Flushes the underlying OutputStream after each event

The effects of this setting depend on the output stream implementation (see org.apache.logging.log4j.core.appender.OutputStream#flush(). In the case of files, for example, setting this attribute to true, guarantees that all bytes written are passed to the operating system, but it does not guarantee that they are actually written to a physical device.

Setting this to true automatically disables buffering.

name

String?

Name of the appender to use in references

regionLength

int?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

A generic list of key/value properties

The meaning of these properties depends on the component.

Filter?

If not null, applies the filter to all events passing through this component

Layout?

Formats the log events

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?

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?

Determines whether to use a buffered OutputStream

If set to true (default) the appender will buffer messages before sending them. This attribute is ignored if immediateFlush is set to true.

bufferSize

int?

Size of the buffer in bytes

fileName

String?

ignoreExceptions

boolean?

Determines whether to propagate logging exceptions

If set to true (default), exceptions that occur during logging will appear in the status logger.

If set to false, exceptions will be propagates to the caller.

immediateFlush

boolean?

Flushes the underlying OutputStream after each event

The effects of this setting depend on the output stream implementation (see org.apache.logging.log4j.core.appender.OutputStream#flush(). In the case of files, for example, setting this attribute to true, guarantees that all bytes written are passed to the operating system, but it does not guarantee that they are actually written to a physical device.

Setting this to true automatically disables buffering.

name

String?

Name of the appender to use in references

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

A generic list of key/value properties

The meaning of these properties depends on the component.

Filter?

If not null, applies the filter to all events passing through this component

Layout?

Formats the log events

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?

Determines whether to use a buffered OutputStream

If set to true (default) the appender will buffer messages before sending them. This attribute is ignored if immediateFlush is set to true.

bufferSize

int?

Size of the buffer in bytes

createOnDemand

boolean?

fileGroup

String?

fileName

String?

fileOwner

String?

filePattern

String

filePermissions

String?

ignoreExceptions

boolean?

Determines whether to propagate logging exceptions

If set to true (default), exceptions that occur during logging will appear in the status logger.

If set to false, exceptions will be propagates to the caller.

immediateFlush

boolean?

Flushes the underlying OutputStream after each event

The effects of this setting depend on the output stream implementation (see org.apache.logging.log4j.core.appender.OutputStream#flush(). In the case of files, for example, setting this attribute to true, guarantees that all bytes written are passed to the operating system, but it does not guarantee that they are actually written to a physical device.

Setting this to true automatically disables buffering.

locking

boolean?

name

String?

Name of the appender to use in references

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

RolloverStrategy?

TriggeringPolicy

Property

Property?

A generic list of key/value properties

The meaning of these properties depends on the component.

Filter?

If not null, applies the filter to all events passing through this component

Layout?

Formats the log events

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?

Determines whether to use a buffered OutputStream

If set to true (default) the appender will buffer messages before sending them. This attribute is ignored if immediateFlush is set to true.

bufferSize

int?

Size of the buffer in bytes

fileGroup

String?

fileName

String?

fileOwner

String?

filePattern

String?

filePermissions

String?

ignoreExceptions

boolean?

Determines whether to propagate logging exceptions

If set to true (default), exceptions that occur during logging will appear in the status logger.

If set to false, exceptions will be propagates to the caller.

immediateFlush

boolean?

Flushes the underlying OutputStream after each event

The effects of this setting depend on the output stream implementation (see org.apache.logging.log4j.core.appender.OutputStream#flush(). In the case of files, for example, setting this attribute to true, guarantees that all bytes written are passed to the operating system, but it does not guarantee that they are actually written to a physical device.

Setting this to true automatically disables buffering.

name

String?

Name of the appender to use in references

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

RolloverStrategy?

TriggeringPolicy?

Property

Property?

A generic list of key/value properties

The meaning of these properties depends on the component.

Filter?

If not null, applies the filter to all events passing through this component

Layout?

Formats the log events

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?

Determines whether to use a buffered OutputStream

If set to true (default) the appender will buffer messages before sending them. This attribute is ignored if immediateFlush is set to true.

bufferSize

int?

Size of the buffer in bytes

connectTimeoutMillis

int?

host

String?

ignoreExceptions

boolean?

Determines whether to propagate logging exceptions

If set to true (default), exceptions that occur during logging will appear in the status logger.

If set to false, exceptions will be propagates to the caller.

immediateFail

boolean?

immediateFlush

boolean?

Flushes the underlying OutputStream after each event

The effects of this setting depend on the output stream implementation (see org.apache.logging.log4j.core.appender.OutputStream#flush(). In the case of files, for example, setting this attribute to true, guarantees that all bytes written are passed to the operating system, but it does not guarantee that they are actually written to a physical device.

Setting this to true automatically disables buffering.

name

String?

Name of the appender to use in references

port

int?

protocol

Protocol?

reconnectDelayMillis

int?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

A generic list of key/value properties

The meaning of these properties depends on the component.

Filter?

If not null, applies the filter to all events passing through this component

Layout?

Formats the log events

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?

Determines whether to use a buffered OutputStream

If set to true (default) the appender will buffer messages before sending them. This attribute is ignored if immediateFlush is set to true.

bufferSize

int?

Size of the buffer in bytes

charset

Charset?

connectTimeoutMillis

int?

enterpriseNumber

String?

eventPrefix

String?

exceptionPattern

String?

facility

Facility?

format

String?

host

String?

id

String?

ignoreExceptions

boolean?

Determines whether to propagate logging exceptions

If set to true (default), exceptions that occur during logging will appear in the status logger.

If set to false, exceptions will be propagates to the caller.

immediateFail

boolean?

immediateFlush

boolean?

Flushes the underlying OutputStream after each event

The effects of this setting depend on the output stream implementation (see org.apache.logging.log4j.core.appender.OutputStream#flush(). In the case of files, for example, setting this attribute to true, guarantees that all bytes written are passed to the operating system, but it does not guarantee that they are actually written to a physical device.

Setting this to true automatically disables buffering.

includeMdc

boolean?

mdcExcludes

String?

mdcId

String?

mdcIncludes

String?

mdcPrefix

String?

mdcRequired

String?

messageId

String?

name

String?

Name of the appender to use in references

newLine

boolean?

newLineEscape

String?

port

int?

protocol

Protocol?

reconnectDelayMillis

int?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Property

Property?

A generic list of key/value properties

The meaning of these properties depends on the component.

Filter?

If not null, applies the filter to all events passing through this component

Layout?

Formats the log events

LoggerFields

LoggerFields?

SocketOptions

SocketOptions?

Ssl

SslConfiguration?

org.apache.logging.log4j.core.appender.db.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.

Known implementations

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 literal=""
               name=""
               parameter=""
               pattern=""
               source=""
               type="">
    <a-StringLayout-implementation/>
</ColumnMapping>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

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

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.

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.

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 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?

Determines whether to propagate logging exceptions

If set to true (default), exceptions that occur during logging will appear in the status logger.

If set to false, exceptions will be propagates to the caller.

name

String?

Name of the appender to use in references

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

NoSqlProvider?

Sets the provider.

Property

Property?

A generic list of key/value properties

The meaning of these properties depends on the component.

Filter?

If not null, applies the filter to all events passing through this component

Layout?

Formats the log events

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

boolean?

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.

org.apache.logging.log4j.core.appender.rewrite.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.

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

Class

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

Provider

org.apache.logging.log4j:log4j-core

org.apache.logging.log4j.core.appender.rolling.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 fileIndex=""
                         max=""
                         min=""
                         stopCustomActionsOnError=""
                         tempCompressedFilePattern="">
    <a-Action-implementation/><!-- multiple occurrences allowed -->
</DefaultRolloverStrategy>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

fileIndex

String?

Defines the file index for rolling strategy.

max

String?

Defines the maximum number of files to keep.

min

String?

Defines the minimum number of files to keep.

stopCustomActionsOnError

boolean?

Defines whether to stop executing asynchronous actions if an error occurs.

tempCompressedFilePattern

String?

Defines temporary compression file pattern.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Action?

Defines custom actions.

org.apache.logging.log4j.core.appender.rolling.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 maxFiles=""
                             stopCustomActionsOnError=""
                             tempCompressedFilePattern="">
    <a-Action-implementation/><!-- multiple occurrences allowed -->
</DirectWriteRolloverStrategy>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

maxFiles

String?

Defines the maximum number of files to keep.

stopCustomActionsOnError

boolean?

Defines whether to stop executing asynchronous actions if an error occurs.

tempCompressedFilePattern

String?

Defines temporary compression file pattern.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Action?

Defines custom actions.

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?

org.apache.logging.log4j.core.appender.rolling.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?

org.apache.logging.log4j.core.appender.rolling.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.

org.apache.logging.log4j.core.appender.rolling.action.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

org.apache.logging.log4j.core.appender.rolling.action.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

org.apache.logging.log4j.core.appender.rolling.action.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

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

Class

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

Provider

org.apache.logging.log4j:log4j-core

Interface for plugins that provide additional compression algorithms.

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/>
    <a-ScriptConditional-implementation/>
</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

ScriptConditional?

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.

org.apache.logging.log4j.core.appender.rolling.action.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.

org.apache.logging.log4j.core.appender.rolling.action.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

Define base path to apply condition before execute POSIX file attribute action.

fileGroup

String?

Define file group to apply during action execution eligible files.

fileOwner

String?

Define file owner to apply during action execution eligible files.

filePermissions

String?

Define file permissions in POSIX format to apply during action execution eligible files.

Example:

rw-rw-rw

r—​r—​r--

followLinks

boolean?

True to allow synonyms links during search of eligible files.

maxDepth

int?

Define max folder depth to search for eligible files to apply POSIX attribute view.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

PathCondition?

Define path conditions to filter files in PosixViewAttributeAction.

JreCompressActionFactoryProvider

Class

org.apache.logging.log4j.core.appender.rolling.action.internal.JreCompressActionFactoryProvider

Provider

org.apache.logging.log4j:log4j-core

XML snippet
<JreCompressActionFactoryProvider/>

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.

org.apache.logging.log4j.core.appender.routing.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-Script-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

Script?

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-Boolean-implementation/>
    <a-Filter-implementation/>
    <a-Layout-implementation/>
    <a-RewritePolicy-implementation/>
    <a-PurgePolicy-implementation/>
    <Routes/>
    <Property/><!-- multiple occurrences allowed -->
    <a-Script-implementation/>
</Routing>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

ignoreExceptions

boolean?

Determines whether to propagate logging exceptions

If set to true (default), exceptions that occur during logging will appear in the status logger.

If set to false, exceptions will be propagates to the caller.

name

String?

Name of the appender to use in references

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Boolean?

RewritePolicy?

PurgePolicy?

Routes

Routes?

Property

Property?

A generic list of key/value properties

The meaning of these properties depends on the component.

Filter?

If not null, applies the filter to all events passing through this component

Layout?

Formats the log events

Script?

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/>

org.apache.logging.log4j.core.async.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.

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

org.apache.logging.log4j.core.config.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

org.apache.logging.log4j.core.config.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. configuration. factory" can be set with the name of the ConfigurationFactory to be used.

  2. A org.apache.logging.log4j.plugins.di.ConfigurableInstanceFactory binding for ConfigurationFactory may be registered.

  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=""
        loggerName="">
    <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?

loggerName

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 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

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.

org.apache.logging.log4j.core.config.URIConfigurationFactory

Class

org.apache.logging.log4j.core.config.URIConfigurationFactory

Provider

org.apache.logging.log4j:log4j-core

Creates configuration from an java.net.URI.

org.apache.logging.log4j.core.config.arbiters.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.

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.

org.apache.logging.log4j.core.config.builder.api.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/>

BigDecimalConverter

Class

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

Provider

org.apache.logging.log4j:log4j-core

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

XML snippet
<BigDecimalConverter/>

BigIntegerConverter

Class

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

Provider

org.apache.logging.log4j:log4j-core

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

XML snippet
<BigIntegerConverter/>

ByteArrayConverter

Class

org.apache.logging.log4j.core.config.plugins.convert.CoreTypeConverters.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
<ByteArrayConverter/>

CharArrayConverter

Class

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

Provider

org.apache.logging.log4j:log4j-core

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

XML snippet
<CharArrayConverter/>

CharsetConverter

Class

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

Provider

org.apache.logging.log4j:log4j-core

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

XML snippet
<CharsetConverter/>

ClassConverter

Class

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

Provider

org.apache.logging.log4j:log4j-core

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

XML snippet
<ClassConverter/>

CronExpressionConverter

Class

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

Provider

org.apache.logging.log4j:log4j-core

XML snippet
<CronExpressionConverter/>

DurationConverter

Class

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

Provider

org.apache.logging.log4j:log4j-core

Converts a java.lang.String into a java.time.Duration.

XML snippet
<DurationConverter/>

FileConverter

Class

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

Provider

org.apache.logging.log4j:log4j-core

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

XML snippet
<FileConverter/>

InetAddressConverter

Class

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

Provider

org.apache.logging.log4j:log4j-core

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

XML snippet
<InetAddressConverter/>

LevelConverter

Class

org.apache.logging.log4j.core.config.plugins.convert.CoreTypeConverters.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
<LevelConverter/>

PathConverter

Class

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

Provider

org.apache.logging.log4j:log4j-core

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

XML snippet
<PathConverter/>

PatternConverter

Class

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

Provider

org.apache.logging.log4j:log4j-core

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

XML snippet
<PatternConverter/>

SecurityProviderConverter

Class

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

Provider

org.apache.logging.log4j:log4j-core

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

XML snippet
<SecurityProviderConverter/>

UriConverter

Class

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

Provider

org.apache.logging.log4j:log4j-core

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

XML snippet
<UriConverter/>

UrlConverter

Class

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

Provider

org.apache.logging.log4j:log4j-core

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

XML snippet
<UrlConverter/>

UuidConverter

Class

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

Provider

org.apache.logging.log4j:log4j-core

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

XML snippet
<UuidConverter/>

ZoneIdConverter

Class

org.apache.logging.log4j.core.config.plugins.convert.CoreTypeConverters.ZoneIdConverter

Provider

org.apache.logging.log4j:log4j-core

XML snippet
<ZoneIdConverter/>

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/>

org.apache.logging.log4j.core.filter.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.

org.apache.logging.log4j.core.filter.AbstractFilterable

Class

org.apache.logging.log4j.core.filter.AbstractFilterable

Provider

org.apache.logging.log4j:log4j-core

Enhances a Class by allowing it to contain Filters.

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?

key

String?

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.

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

KeyValuePair

KeyValuePair?

org.apache.logging.log4j.core.filter.Filterable

Class

org.apache.logging.log4j.core.filter.Filterable

Provider

org.apache.logging.log4j:log4j-core

Interface implemented by Classes that allow filtering to occur.

Extends LifeCycle since filters have a life cycle.

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

This filter returns the onMatch result if the message matches the regular expression.

The "useRawMsg" attribute can be used to indicate whether the regular expression should be applied to the result of calling Message. getMessageFormat (true) or Message. getFormattedMessage() (false). The default is false.

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, the raw message will be used, otherwise the formatted message will be used.

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.

StringMatchFilter

Class

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

Provider

org.apache.logging.log4j:log4j-core

This filter returns the onMatch result if the message in the event matches the specified text 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?

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?

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.

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?

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.

start

String?

timezone

ZoneId?

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

Class

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

Provider

org.apache.logging.log4j:log4j-core

Abstract base class for Layouts.

org.apache.logging.log4j.core.layout.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.

org.apache.logging.log4j.core.layout.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.

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?

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

Class

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

Provider

org.apache.logging.log4j:log4j-core

Possible font sizes

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?

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?

org.apache.logging.log4j.core.layout.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?

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?

org.apache.logging.log4j.core.lookup.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

org.apache.logging.log4j.core.lookup.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/>

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/>

org.apache.logging.log4j.core.lookup.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.

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/>

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

Class

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

Provider

org.apache.logging.log4j:log4j-core

org.apache.logging.log4j.core.net.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/>

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

Class

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

Provider

org.apache.logging.log4j:log4j-core

Enumerates the supported protocols.

org.apache.logging.log4j.core.net.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?

oobInline

Boolean?

receiveBufferSize

Integer?

reuseAddress

Boolean?

rfc1349TrafficClass

Rfc1349TrafficClass?

sendBufferSize

Integer?

soLinger

Integer?

soTimeout

Integer?

tcpNoDelay

Boolean?

trafficClass

Integer?

Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

SocketPerformancePreferences

SocketPerformancePreferences?

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

org.apache.logging.log4j.core.net.ssl.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

Path?

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.

org.apache.logging.log4j.core.net.ssl.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

Path?

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".

org.apache.logging.log4j.core.pattern.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.

org.apache.logging.log4j.core.pattern.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/>

org.apache.logging.log4j.core.pattern.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

org.apache.logging.log4j.core.pattern.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/>

org.apache.logging.log4j.core.pattern.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/>

org.apache.logging.log4j.core.pattern.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/>

org.apache.logging.log4j.core.util.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

KeyValuePair

Class

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

Provider

org.apache.logging.log4j:log4j-core

Key/Value pair configuration item.

XML snippet
<KeyValuePair/>

org.apache.logging.log4j.core.util.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

org.apache.logging.log4j.plugins.convert.TypeConverter

Class

org.apache.logging.log4j.plugins.convert.TypeConverter

Provider

org.apache.logging.log4j:log4j-core

org.apache.logging.log4j.plugins.util.Builder

Class

org.apache.logging.log4j.plugins.util.Builder

Provider

org.apache.logging.log4j:log4j-core

org.apache.logging.log4j:log4j-csv

org.apache.commons.csv.QuoteMode

Class

org.apache.commons.csv.QuoteMode

Provider

org.apache.logging.log4j:log4j-csv

org.apache.logging.log4j.csv.layout.AbstractCsvLayout

Class

org.apache.logging.log4j.csv.layout.AbstractCsvLayout

Provider

org.apache.logging.log4j:log4j-csv

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

Depends on Apache Commons CSV 1.2.

Known implementations

CsvLogEventLayout

Class

org.apache.logging.log4j.csv.layout.CsvLogEventLayout

Provider

org.apache.logging.log4j:log4j-csv

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.csv.layout.CsvParameterLayout

Provider

org.apache.logging.log4j:log4j-csv

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?

org.apache.logging.log4j:log4j-docker

docker

Class

org.apache.logging.log4j.docker.DockerLookup

Provider

org.apache.logging.log4j:log4j-docker

Looks up keys for a Docker container.

XML snippet
<docker/>

org.apache.logging.log4j:log4j-jctools

JCToolsBlockingQueue

Class

org.apache.logging.log4j.jctools.JCToolsBlockingQueueFactory

Provider

org.apache.logging.log4j:log4j-jctools

A BlockingQueueFactory based on JCTools.

XML snippet
<JCToolsBlockingQueue waitStrategy=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

waitStrategy

WaitStrategy?

org.apache.logging.log4j.jctools.JCToolsBlockingQueueFactory.WaitStrategy

Class

org.apache.logging.log4j.jctools.JCToolsBlockingQueueFactory.WaitStrategy

Provider

org.apache.logging.log4j:log4j-jctools

org.apache.logging.log4j:log4j-jdbc

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

Class

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

Provider

org.apache.logging.log4j:log4j-jdbc

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

Class

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

Provider

org.apache.logging.log4j:log4j-jdbc

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.jdbc.appender.ColumnConfig

Provider

org.apache.logging.log4j:log4j-jdbc

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

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

Class

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

Provider

org.apache.logging.log4j:log4j-jdbc

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.

DriverManager

Class

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

Provider

org.apache.logging.log4j:log4j-jdbc

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.jdbc.appender.FactoryMethodConnectionSource

Provider

org.apache.logging.log4j:log4j-jdbc

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.jdbc.appender.JdbcAppender

Provider

org.apache.logging.log4j:log4j-jdbc

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.jdbc.appender.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 -->
    <Property/><!-- multiple occurrences allowed -->
    <Column/><!-- multiple occurrences allowed -->
    <a-ConnectionSource-implementation/>
</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?

Property

Property?

Filter?

Layout?

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.

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

PoolableConnectionFactory

Class

org.apache.logging.log4j.dbcp2.appender.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.dbcp2.appender.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="">
    <Property/><!-- multiple occurrences allowed -->
    <PoolableConnectionFactory/>
</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

Property

Property?

PoolableConnectionFactory

PoolableConnectionFactoryConfig?

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

DataSource

Class

org.apache.logging.log4j.jdbc.jndi.DataSourceConnectionSource

Provider

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

A org.apache.logging.log4j.jdbc.jndi.org.apache.logging.log4j.jdbc.appender.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.

org.apache.logging.log4j:log4j-jndi

jndi

Class

org.apache.logging.log4j.jndi.lookup.JndiLookup

Provider

org.apache.logging.log4j:log4j-jndi

Looks up keys from JNDI resources.

XML snippet
<jndi/>

org.apache.logging.log4j: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=""
                    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

Integer?

nullEventDelimiterEnabled

Boolean?

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?

org.apache.logging.log4j.layout.template.json.JsonTemplateLayout.EventTemplateAdditionalField.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/>

org.apache.logging.log4j.layout.template.json.resolver.EventResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.EventResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

TemplateResolverFactory specialized for org.apache.logging.log4j.core.LogEvents.

org.apache.logging.log4j.layout.template.json.resolver.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/>

org.apache.logging.log4j.layout.template.json.resolver.TemplateResolverFactory

Class

org.apache.logging.log4j.layout.template.json.resolver.TemplateResolverFactory

Provider

org.apache.logging.log4j:log4j-layout-template-json

org.apache.logging.log4j.layout.template.json.resolver.TemplateResolver factory.

org.apache.logging.log4j.layout.template.json.resolver.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/>

org.apache.logging.log4j:log4j-mongodb

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

Class

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

Provider

org.apache.logging.log4j:log4j-mongodb

Known implementations

MongoDb

Class

org.apache.logging.log4j.mongodb.MongoDbProvider

Provider

org.apache.logging.log4j:log4j-mongodb

The MongoDB implementation of NoSqlProvider using the MongoDB driver version 5 API.

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?

org.apache.logging.log4j:log4j-plugins-test

org.apache.logging.log4j.plugins.test.validation.AbstractPluginWithGenericBuilder

Class

org.apache.logging.log4j.plugins.test.validation.AbstractPluginWithGenericBuilder

Provider

org.apache.logging.log4j:log4j-plugins-test

Known implementations

Fake

Class

org.apache.logging.log4j.plugins.test.validation.FakePlugin

Provider

org.apache.logging.log4j:log4j-plugins-test

Test plugin class for unit tests.

XML snippet
<Fake/>

Nested

Class

org.apache.logging.log4j.plugins.test.validation.FakePlugin.Nested

Provider

org.apache.logging.log4j:log4j-plugins-test

XML snippet
<Nested/>

HostAndPort

Class

org.apache.logging.log4j.plugins.test.validation.HostAndPort

Provider

org.apache.logging.log4j:log4j-plugins-test

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

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

host

String?

port

int?

PluginWithGenericSubclassFoo1Builder

Class

org.apache.logging.log4j.plugins.test.validation.PluginWithGenericSubclassFoo1Builder

Provider

org.apache.logging.log4j:log4j-plugins-test

XML snippet
<PluginWithGenericSubclassFoo1Builder foo1=""
                                      thing=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

foo1

String

thing

String

Validator

Class

org.apache.logging.log4j.plugins.test.validation.ValidatingPlugin

Provider

org.apache.logging.log4j:log4j-plugins-test

XML snippet
<Validator name=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

name

String

ValidatingPluginWithGenericBuilder

Class

org.apache.logging.log4j.plugins.test.validation.ValidatingPluginWithGenericBuilder

Provider

org.apache.logging.log4j:log4j-plugins-test

XML snippet
<ValidatingPluginWithGenericBuilder name=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

name

String

ValidatingPluginWithTypedBuilder

Class

org.apache.logging.log4j.plugins.test.validation.ValidatingPluginWithTypedBuilder

Provider

org.apache.logging.log4j:log4j-plugins-test

XML snippet
<ValidatingPluginWithTypedBuilder name=""/>
Attributes

Optional attributes are denoted by ?-suffixed types.

Name Type Default Description

name

String

Alpha

Class

org.apache.logging.log4j.plugins.test.validation.di.AlphaBean

Provider

org.apache.logging.log4j:log4j-plugins-test

XML snippet
<Alpha/>

org.apache.logging.log4j.plugins.test.validation.di.BaseBean

Class

org.apache.logging.log4j.plugins.test.validation.di.BaseBean

Provider

org.apache.logging.log4j:log4j-plugins-test

Known implementations

Beta

Class

org.apache.logging.log4j.plugins.test.validation.di.BetaBean

Provider

org.apache.logging.log4j:log4j-plugins-test

XML snippet
<Beta/>

configurable

Class

org.apache.logging.log4j.plugins.test.validation.di.ConfigurablePlugin

Provider

org.apache.logging.log4j:log4j-plugins-test

XML snippet
<configurable/>

ConfigurableRecord

Class

org.apache.logging.log4j.plugins.test.validation.di.ConfigurableRecord

Provider

org.apache.logging.log4j:log4j-plugins-test

XML snippet
<ConfigurableRecord/>

Gamma

Class

org.apache.logging.log4j.plugins.test.validation.di.GammaBean

Provider

org.apache.logging.log4j:log4j-plugins-test

XML snippet
<Gamma/>

org.apache.logging.log4j:log4j-script

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

Class

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

Provider

org.apache.logging.log4j:log4j-script

Known implementations

org.apache.logging.log4j.core.script.ScriptConditional

Class

org.apache.logging.log4j.core.script.ScriptConditional

Provider

org.apache.logging.log4j:log4j-script

Known implementations

org.apache.logging.log4j.script.AbstractScript

Class

org.apache.logging.log4j.script.AbstractScript

Provider

org.apache.logging.log4j:log4j-script

Container for the language and body of a script.

Known implementations

ScriptFile

Class

org.apache.logging.log4j.script.ScriptFile

Provider

org.apache.logging.log4j:log4j-script

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?

Script

Class

org.apache.logging.log4j.script.ScriptPlugin

Provider

org.apache.logging.log4j:log4j-script

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?

ScriptRef

Class

org.apache.logging.log4j.script.ScriptRef

Provider

org.apache.logging.log4j:log4j-script

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?

Scripts

Class

org.apache.logging.log4j.script.ScriptsPlugin

Provider

org.apache.logging.log4j:log4j-script

A container of Scripts.

XML snippet
<Scripts/>
Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

AbstractScript?

An array of Scripts.

ScriptAppenderSelector

Class

org.apache.logging.log4j.script.appender.ScriptAppenderSelector

Provider

org.apache.logging.log4j:log4j-script

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

ScriptCondition

Class

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

Provider

org.apache.logging.log4j:log4j-script

A condition of the org.apache.logging.log4j.script.appender.rolling.action.DeleteAction where a user-provided script selects the files to delete from a provided list.

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

XML snippet
<ScriptCondition/>
Nested components

Optional components are denoted by ?-suffixed types.

Tag Type Description

Script?

The script to run. This may be a Script, a org.apache.logging.log4j.script.appender.rolling.action.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.script.appender.rolling.action.PathWithAttribute objects. (The script is free to modify and return this list. )

  • substitutor - a org.apache.logging.log4j.script.appender.rolling.action.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

ScriptArbiter

Class

org.apache.logging.log4j.script.config.arbiter.ScriptArbiter

Provider

org.apache.logging.log4j:log4j-script

Condition that evaluates a script.

XML snippet
<ScriptArbiter/>

ScriptFilter

Class

org.apache.logging.log4j.script.filter.ScriptFilter

Provider

org.apache.logging.log4j:log4j-script

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

XML snippet
<ScriptFilter onMatch=""
              onMismatch="">
    <a-Script-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

Script?

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

ScriptPatternSelector

Class

org.apache.logging.log4j.script.layout.ScriptPatternSelector

Provider

org.apache.logging.log4j:log4j-script

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?