Release Notes

2.23.1

Release date

2024-03-06

This release contains several small fixes and some dependency updates.

Changed

  • Improve performance of CloseableThreadContext#closeMap() (2296)

Fixed

  • Fix handling of LoggerContextAware lookups (2309)

  • Fix NPE in PatternProcessor for a UNIX_MILLIS pattern (2346)

  • Fix that parameterized message formatting doesn’t throw an exception when there are insufficient number of parameters (2343)

  • Fix StatusLogger log level filtering when debug mode is enabled (2337)

  • Add log4j2.StatusLogger.dateFormatZone system property to set the time-zone StatusLogger uses to format java.time.Instant. Without this, formatting patterns accessing to time-zone-specific fields (e.g., year-of-era) cause failures. (2322)

  • Fix StatusLogger to correctly read log4j2.StatusLogger.properties resource (2354)

  • Fix stack overflow in StatusLogger (2322)

Updated

  • Update jakarta.activation:jakarta.activation-api to version 2.1.3 (2335)

  • Update jakarta.mail:jakarta.mail-api to version 2.1.3 (2348)

  • Update org.apache.commons:commons-compress to version 1.26.0 (2304)

  • Update org.apache.commons:commons-dbcp2 to version 2.12.0 (2344)

  • Update org.apache.kafka:kafka-clients to version 3.7.0 (2326)

  • Update org.eclipse.angus:angus-activation to version 2.0.2 (2336)

  • Update org.eclipse.angus:jakarta.mail to version 2.0.3 (2349)

2.23.0

Release date

2024-02-17

This release adds support for LMAX Disruptor 4.x and several performance and bug fixes.

In order to maintain compatibility with JRE 8, support for LMAX Disruptor 3.x is maintained.

Added

  • Added support for LMAX Disruptor 4.x (1821)

Changed

  • Simplify BND configuration after upgrade from version 6.4.1 to 7.0.0

Deprecated

  • Deprecate the configuration attribute verbose (i.e., <Configuration verbose="…​") and StatusConsoleListener filters (2226)

  • Deprecated the RingBufferLogEventHandler class for removal from the public API in 3.x

Fixed

  • Fix regression in JdkMapAdapterStringMap performance. (2238)

  • Fix the behavior of Logger#setLevel and Logger#getLevel in the Log4j 1.2 bridge. (2282)

  • Fix the behavior of CoreLogger#getLevel and CoreLogger#setLevel in the log4j-jul module. (2282)

  • Allow deserialization of all arrays of allowed classes. (LOG4J2-3680)

  • Allow the <Properties> node to appear in any position in the configuration element.

  • Fix forgotten threadName field in RingBufferLogEvent#clear() (2234)

  • Fix StringBuilder cache corruption on recursive access

  • Fixed use of SecurityManager in LoaderUtil where AccessController::doPrivileged should only be invoked when a SecurityManager is installed. Some runtimes do not seem to have this method available. (2129)

  • Fix log4j-spring-cloud-config-client dependencies to include only those required. (2157)

  • Fix typo in Kubernetes clientKeyData configuration property.

Updated

  • Update com.fasterxml.jackson:jackson-bom to version 2.16.1 (2126)

  • Update commons-codec:commons-codec to version 1.16.1 (2277)

  • Update io.netty:netty-bom to version 4.1.107.Final (2284)

  • Update org.apache.logging:logging-parent to version 10.6.0 (2197)

  • Update org.eclipse.jetty:jetty-bom to version 9.4.54.v20240208 (2287)

  • Update org.jctools:jctools-core to version 4.0.3 (2270)

  • Update org.springframework:spring-framework-bom to version 5.3.32 (2293)

  • Update org.zeromq:jeromq to version 0.6.0 (2271)

2.22.1

Release date

2023-12-22

This release contains only dependency upgrades and bug fixes, which do not change the behavior of the artifacts.

While maintaining compatibility with Java 8, the artifacts in this release where generated using JDK 17, unlike version 2.22.0 that used JDK 11.

Fixed

  • Mark JdkMapAdapterStringMap as frozen if map is immutable. (2098)

  • Fix NPE in CloseableThreadContext. (1426)

  • Use the module name of Conversant Media Disruptor from version 1.2.16+ of the library.

  • Fix NPE in RollingFileManager. (1645)

  • Fix log4j-to-slf4j JPMS and OSGi descriptors. (1983)

  • Workaround a Coursier/Ivy dependency resolution bug affecting log4j-slf4j-impl and log4j-mongodb3. (2065)

Updated

  • Bumped the minimum Java version required for the build to Java 17. Runtime requirements remain unchanged. (2021)

  • Update com.github.luben:zstd-jni to version 1.5.5-11 (2030)

  • Update com.google.guava:guava to version 33.0.0-jre (2110)

  • Update commons-codec:commons-codec to version 1.16.0 (2042)

  • Update commons-io:commons-io to version 2.15.1 (2034)

  • Update commons-logging:commons-logging to version 1.3.0 (2050)

  • Update io.netty:netty-bom to version 4.1.104.Final (2095)

  • Update org.apache.commons:commons-compress to version 1.25.0 (2045)

  • Update org.apache.commons:commons-dbcp2 to version 2.11.0 (2048)

  • Update org.apache.commons:commons-lang3 to version 3.14.0 (2047)

  • Update org.apache.commons:commons-pool2 to version 2.12.0 (2057)

  • Update org.apache.kafka:kafka-clients to version 3.6.1 (2068)

  • Update org.apache.logging:logging-parent to version 10.5.0 (2119)

  • Update org.jctools:jctools-core to version 4.0.2 (1984)

  • Update org.springframework.boot:spring-boot to version 2.7.18 (1998)

  • Update org.springframework.cloud:spring-cloud-dependencies to version 2021.0.9 (2109)

2.22.0

Release date

2023-11-17

This releases provides a CycloneDX Software Bill of Materials (SBOM) along with each artifact and contains bug fixes addressing issues in the JPMS & OSGi infrastructure overhauled in 2.21.0, dependency updates, and some other minor fixes and improvements.

CycloneDX Software Bill of Materials (SBOM)

This is the first Log4j release that provides a CycloneDX Software Bill of Materials (SBOM) along with each artifact. Generated SBOMs are attached as artifacts with cyclonedx classifier and XML extensions, that is, <artifactId>-<version>-cyclonedx.xml. They contain vulnerability-assertion references to a CycloneDX Vulnerability Disclosure Report (VDR) that Apache Logging Services uses for all projects it maintains. This VDR is accessible through the following URL: https://logging.apache.org/cyclonedx/vdr.xml

SBOM generation is streamlined by logging-parent, see its website for details.

Changed

  • Change the order of evaluation of FormattedMessage formatters. Messages are evaluated using java.util.Format only if they don’t comply to the java.text.MessageFormat or ParameterizedMessage format. (1223)

  • Change default encoding of HTTP Basic Authentication to UTF-8 and add log4j2.configurationAuthorizationEncoding property to overwrite it. (1970)

Fixed

  • Harden deserialization process by requiring the usage of FilteredObjectInputStream on Java 8 and ObjectInputFilter on Java 9+ to deserialize custom classes. (1906)

  • Fix MDC pattern converter causing issues for %notEmpty (1922)

  • Export missing OSGi & JPMS modules in log4j-layout-template-json and log4j-1.2-api (1895)

  • Fix spring-test dependency scope change (LOG4J2-3675)

  • Fix JPMS descriptors causing jlink issues (1896)

  • Add missing Implementation- and Specification- entries to MANIFEST.MF (implemented by logging-parent version 10.3.0 update) (1923)

  • Fix NotSerializableException thrown when Logger is serialized with a ReusableMessageFactory (1884)

Removed

  • Removed unused FastDateParser which was causing unnecessary heap overhead (LOG4J2-3672, 1848)

Updated

  • Update com.fasterxml.jackson:jackson-bom to version 2.16.0 (1974)

  • Update com.github.luben:zstd-jni to version 1.5.5-10 (1940)

  • Update com.google.guava:guava to version 32.1.3-jre (1875)

  • Update io.netty:netty-bom to version 4.1.101.Final (1960)

  • Update org.eclipse.persistence:org.eclipse.persistence.jpa to version 2.7.13 (1900)

  • Update org.fusesource.jansi:jansi to version 2.4.1 (1907)

  • Update org.mongodb:bson to version 4.11.1 (1957)

  • Update org.springframework:spring-framework-bom to version 5.3.30

  • Update org.springframework.boot:spring-boot to version 2.7.17 (1874)

  • Update org.springframework:spring-framework-bom to version 5.3.31 (1973)

  • Update org.zeromq:jeromq to version 0.5.4 (1878)

2.21.1

Release date

2023-10-20

This patch release contains only the fix of a log4j-jcl bug that prevents it from connecting with commons-logging.

The Log4j 2.21.1 API, as well as the other artifacts, maintains binary compatibility with the previous release.

Apache Log4j 2.21.1 requires Java 8 to run. The build requires JDK 11 and generates reproducible binaries.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, get support, or suggestions for improvement, see the Apache Log4j 2 website.

Fixed

  • Fixes the Apache Commons Logging (JCL) bridge: log4j-jcl. (1865)

2.21.0

Release date

2023-10-12

This release primarily focuses on enhancements to our OSGi and JPMS support and contains several bug fixes. It will be the first release built and signed by the CI using the ASF Logging Services Release Manager GPG key, which is shared in KEYS.

The Log4j 2.21.0 API, as well as the other artifacts, maintains binary compatibility with the previous release.

Apache Log4j 2.21.0 requires Java 8 to run. The build requires JDK 11 and generates reproducible binaries.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, get support, or suggestions for improvement, see the Apache Log4j 2 website.

OSGi changes

All the published artifacts are OSGi bundles or fragments.

This release introduces a change in the bundle symbolic names to allow them to function as JPMS module name: all hyphens - present in the bundle names of previous releases were replaced by dots ..

JPMS changes

All the published artifacts have been migrated from automatic modules to named JPMS modules. All packages marked as private in the Javadoc are not exported.

The module name of four bridges (log4j-slf4j-impl, log4j-slf4j2-impl, log4j-to-jul and log4j-to-slf4j) have been changed to adhere to the same convention as the OSGi bundle names.

Added

Changed

  • Open FileExtension methods to allow their usage in custom RolloverStrategys (1365, 1683)

  • Bumped the minimum Java version required for the build to JDK 11. Runtime requirements remain unchanged. (1369)

  • Set the default minLevel and maxLevel of LevelRangeFilter to OFF and ALL, respectively (1503)

  • Removed additional isFiltered checks in AsyncLoggerConfig (1550)

  • Use Java version-specific warnings in StackLocator (1760)

  • Started logging a status error event instead of an NPE in OsgiServiceLocator.loadServices(Class, Lookup, boolean) when a bundle has no valid BundleContext for a service type

  • Implemented a CI-based release process

Fixed

  • Added validation to rolling file manager path conditions (1231)

  • Adapted the OSGi metadata of log4j-to-slf4j to work with SLF4J 1 and 2. To achieve that used a version range of [1.7,3) for the imported SLF4J packages. (1232)

  • Fixed Javadoc failures (1275, 1753)

  • Removed locale-dependent toLowerCase/toUpperCase calls (1281)

  • Redirected old /<module>/apidocs URLs (broken in 2.20.0) to /javadoc/<module> (1284)

  • Added environment variable arbiter (1312)

  • Fixed logging of java.sql.Date objects by appending it before Log4J tries to call java.util.Date.toInstant() on it (1366)

  • Adapted the OSGi metadata of log4j-api, log4j-core, log4j-slf4j-impl and log4j-slf4j2-impl to activate the bundle when it is accessed. To achieve that set the Bundle-ActivationPolicy to lazy for the log4j bundles. (1367)

  • Avoided using released objects in StackTraceStringResolver of JsonTemplateLayout (1380)

  • Added missing setter for connectionStringSource in MongoDb4Provider builder (1389)

  • Fixed NPE in PluginElementVisitor (1391)

  • Added columnType as alias for the column mapping type attribute (1405)

  • Restored Log4jMarker visibility in SLF4J adapters (1414)

  • Fixed buffer size in Log4jFixedFormatter date time formatter (1418)

  • Fixed the propagation of synchronous action failures in RollingFileManager and FileRenameAction (1445, 1549)

  • Fixed RollingFileManager to propagate failed synchronous actions correctly (1445)

  • Replaced the usage of System.out in StackLocator for warnings with System.err (1484)

  • Fixed concurrent date-time formatting issue in PatternLayout (1485)

  • Fixed runtime dependencies documentation (1530)

  • Allowed to override FQCN in Log4jEventBuilder by implementing CallerBoundaryAware (1533)

  • Migrated MongoDB tests to JUnit 5 and Flapdoodle Embedded MongoDB 4 (1589)

  • Rewrote message parameter formatter with improved escape handling (1626)

  • Improved formatting and serialization of StackTraceElement on JDK 9+ (1640)

  • Fixed MemoryMappedFileAppender buffer unmapping on JRE 9+ (1646)

  • Fixed rollover strategy in the Log4j 1.x compatibility layer (1650)

  • Removed incorrect mention of base64 lookup and improve the rest of the lookup manual (1681, LOG4J2-3504)

  • Implemented LocationAware for JsonTemplateLayout, since this was causing location not being passed to underlying appenders (1692)

  • Added support for long values in MongoDb 4 appender to configure collectionSize (1747)

  • Only shutdown Log4j after last Log4jServletContextListener is executed (1782)

  • Allowed using Spring Arbiter without a Spring environment (1783)

  • Fixed context data loss if <AsyncLogger> components are used with an all async logger context (1786)

  • Fixed JsonTemplateLayout NPE thrown on custom log levels (1805)

  • Improved Log4j-config.xsd schema (LOG4J2-170)

  • Fixed NPE in ContextSelector (LOG4J2-3217, 1538)

  • Avoided allocating ThreadLocals in AbstractLogger when they are disabled, since this was causing memory leaks due to retained reference to class loaders in web applications (LOG4J2-3657)

  • Fixed %notEmpty directive of PatternLayout for empty MDC/NDC inputs (LOG4J2-3660)

  • Fixed file descriptor leak on Tomcat (LOG4J2-3663)

  • Ensured FileOutputStream is closed in CommonsCompressAction.execute()

Removed

Updated

  • Update Eclipse Angus Activation to version 2.0.1 (1591)

  • Update Eclipse Angus Mail to version 2.0.2 (1591)

  • Update com.datastax.cassandra:cassandra-driver-core to version 3.11.5 (1591)

  • Update Apache Cassandra to version 3.11.16 (1591)

  • Update Apache Commons Compress to version 1.24.0 (1591)

  • Update Apache Commons CSV to version 1.10.0 (1591)

  • Update Jackson to version 2.15.2 (1591)

  • Update Jakarta Activation API to version 2.1.2 (1591)

  • Update Jakarta Mail API to version 2.1.2 (1591)

  • Update JCTools to version 4.0.1 (1591)

  • Update Apache Kafka to version 3.4.0 (1591)

  • Update Kubernetes client to version 5.12.4 (1591)

  • Update org.mongodb:mongodb-driver-core to version 4.10.2 (1591)

  • Update io.netty:netty-bom to version 4.1.97 (1591)

  • Update Spring Boot to version 2.7.15 (1591)

  • Update Spring Framework to version 5.3.29 (1591)

  • Update Tomcat JULI to version 10.0.27 (1591)

  • Update Woodstox to version 6.5.1 (1591)

2.20.0

Release date

2023-02-17

This release primarily contains bug fixes and minor enhancements.

Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters. log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and later. SLF4J-2.0.0 alpha releases are not fully supported. See LOG4J2-2975 and SLF4J-511.

The Log4j 2.20.0 API, as well as many core components, maintains binary compatibility with previous releases.

Apache Log4j 2.20.0 requires a minimum of Java 8 to build and run. Log4j 2.12.4 is the last release to support Java 7. Log4j 2.3.2 is the last release to support Java 6. Java 6 and Java 7 are no longer supported by the Log4j team.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Add support for timezones in RollingFileAppender date pattern (LOG4J2-1631)

  • Add LogEvent timestamp to ProducerRecord in KafkaAppender (LOG4J2-2678)

  • Add PatternLayout support for abbreviating the name of all logger components except the 2 rightmost (LOG4J2-2785)

  • Removes internal field that leaked into public API. (LOG4J2-3615)

  • Add a LogBuilder#logAndGet() method to emulate the Logger#traceEntry method. (LOG4J2-3645)

Changed

  • Simplify site generation (1166)

  • Switch the issue tracker from JIRA to GitHub Issues (1172)

  • Remove liquibase-log4j2 maven module (1193)

  • Fix order of stacktrace elements, that causes cache misses in ThrowableProxyHelper. (1214)

  • Switch from com.sun.mail to Eclipse Angus. (LOG4J2-3554)

  • Add Log4j2 Core as default runtime dependency of the SLF4J2-to-Log4j2 API bridge. (LOG4J2-3601)

  • Replace maven-changes-plugin with a custom changelog implementation (LOG4J2-3628)

  • Moved log4j-api and log4j-core artifacts with classifier tests to log4j-api-test and log4j-core-test respectively. (LOG4J2-3650)

Deprecated

  • Deprecate support for package scanning for plugins (LOG4J2-3644)

Fixed

  • Copy programmatically supplied location even if includeLocation="false". (1197)

  • Eliminate status logger warning, when disableAnsi or noConsoleNoAnsi is used the style and highlight patterns. (1202)

  • Fix detection of location requirements in RewriteAppender. (1274)

  • Replace regex with manual code to escape characters in Rfc5424Layout. (1277)

  • Fix java.sql.Time object formatting in MapMessage (LOG4J2-2297)

  • Fix previous fire time computation in CronTriggeringPolicy (LOG4J2-3357)

  • Correct default to not include location for AsyncRootLoggers (LOG4J2-3487)

  • Lazily evaluate the level of a SLF4J LogEventBuilder (LOG4J2-3598)

  • Fixes priority of Legacy system properties, which are now back to having higher priority than Environment variables. (LOG4J2-3615)

  • Protects ServiceLoaderUtil from unchecked ServiceLoader exceptions. (LOG4J2-3624)

  • Fix Configurator#setLevel for internal classes (LOG4J2-3631)

  • Fix level propagation in Log4jBridgeHandler (LOG4J2-3634)

  • Disable OsgiServiceLocator if not running in OSGI container. (LOG4J2-3642)

  • When using a Date Lookup in the file pattern the current time should be used. (LOG4J2-3643)

  • Fixed LogBuilder filtering in the presence of global filters. (LOG4J2-3647)

2.19.0

Release date

2022-09-09

This release primarily contains bug fixes and minor enhancements.

Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters. log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and later. SLF4J-2.0.0 alpha releases are not fully supported. See LOG4J2-2975 and SLF4J-511.

The Log4j 2.19.0 API, as well as many core components, maintains binary compatibility with previous releases.

Apache Log4j 2.19.0 requires a minimum of Java 8 to build and run. Log4j 2.12.4 is the last release to support Java 7. Log4j 2.3.2 is the last release to support Java 6. Java 6 and Java 7 are no longer supported by the Log4j team.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Add implementation of SLF4J2 fluent API. (LOG4J2-2975)

  • Add support for SLF4J2 stack-valued MDC. (LOG4J2-3583)

Changed

  • Add getExplicitLevel method to LoggerConfig. (LOG4J2-3572)

  • Allow PropertySources to be added. (LOG4J2-3588)

  • Allow Plugins to be injected with the LoggerContext reference. (LOG4J2-3589)

Fixed

  • Add correct manifest entries for OSGi to log4j-jcl (LOG4J2-3545)

  • Improve support for passwordless keystores. (LOG4J2-3548)

  • SystemPropertyArbiter was assigning the value as the name. (LOG4J2-3550)

  • Make JsonTemplateLayout stack trace truncation operate for each label block. (LOG4J2-3556)

  • Fix recursion between Log4j 1.2 LogManager and Category. (LOG4J2-3557)

  • Fix resolution of properties not starting with log4j2.. (LOG4J2-3559)

  • Logger$PrivateConfig.filter(Level, Marker, String) was allocating empty varargs array. (LOG4J2-3560)

  • Allows a space separated list of style specifiers in the %style pattern for consistency with %highlight. (LOG4J2-3561)

  • Fix NPE in log4j-to-jul in the case the root logger level is null. (LOG4J2-3564)

  • Fix RollingRandomAccessFileAppender with DirectWriteRolloverStrategy can’t create the first log file of different directory. (LOG4J2-3565)

  • Generate new SSL certs for testing. (LOG4J2-3578)

  • Fix ServiceLoaderUtil behavior in the presence of a SecurityManager. (LOG4J2-3579)

  • Make StatusConsoleListener use SimpleLogger internally. (LOG4J2-3584)

  • Fix regression in Rfc5424Layout default values. (LOG4J2-3587)

  • Harden InstantFormatter against delegate failures. (LOG4J2-3614)

  • Add async support to Log4jServletFilter. (LOG4J2-708)

Removed

  • Removed build page in favor of a single build instructions file. (LOG4J2-3573)

  • Remove SLF4J 1.8.x binding. (LOG4J2-3590)

2.18.0

Release date

2022-06-28

This release primarily contains bug fixes and minor enhancements.

Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters. log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and later. SLF4J-2.0.0 alpha releases are not fully supported. See LOG4J2-2975 and SLF4J-511.

The Log4j 2.18.0 API, as well as many core components, maintains binary compatibility with previous releases.

Apache Log4j 2.18.0 requires a minimum of Java 8 to build and run. Log4j 2.12.4 is the last release to support Java 7. Log4j 2.3.2 is the last release to support Java 6. Java 6 and Java 7 are no longer supported by the Log4j team.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Add support for Jakarta Mail API in the SMTP appender. (LOG4J2-3362)

  • Add support for custom Log4j 1.x levels. (LOG4J2-3419)

  • Add support for adding and retrieving appenders in Log4j 1.x bridge. (LOG4J2-3440)

  • Add support for custom LMAX disruptor WaitStrategy configuration. (LOG4J2-3472)

  • Add support for Apache Extras' RollingFileAppender in Log4j 1.x bridge. (LOG4J2-3483)

  • Add MutableThreadContextMapFilter. (LOG4J2-3495)

  • Add support for 24 colors in highlighting (LOG4J2-3538)

Changed

  • Improves ServiceLoader support on servlet containers. (LOG4J2-3427)

  • Make the default disruptor WaitStrategy used by Async Loggers garbage-free. (LOG4J2-3473)

  • Do not throw UnsupportedOperationException when JUL ApiLogger::setLevel is called. (LOG4J2-3476)

  • Support Spring 2.6.x. (LOG4J2-3506)

  • Move perf tests to log4j-core-its (LOG4J2-3516)

  • Upgrade the Flume Appender to Flume 1.10.0 (LOG4J2-3536)

Fixed

  • Fix minor typo #792.

  • Improve validation and reporting of configuration errors.

  • Allow enterprise id to be an OID fragment. (LOG4J2-1376)

  • Fix problem with non-uppercase custom levels. (LOG4J2-2872)

  • Avoid ClassCastException in JeroMqManager with custom LoggerContextFactory #791. (LOG4J2-3040)

  • DirectWriteRolloverStrategy should use the current time when creating files. (LOG4J2-3339)

  • Fixes the syslog appender in Log4j 1.x bridge, when used with a custom layout. (LOG4J2-3359)

  • log4j-1.2-api 2.17.2 throws NullPointerException while removing appender with name as null. (LOG4J2-3359)

  • Improve JsonTemplateLayout performance. (LOG4J2-3393)

  • Fix resolution of non-Log4j properties. (LOG4J2-3413)

  • Fixes Spring Boot logging system registration in a multi-application environment. (LOG4J2-3418)

  • JAR file containing Log4j configuration isn’t closed. (LOG4J2-3423)

  • Properties defined in configuration using a value attribute (as opposed to element) are read correctly. (LOG4J2-3424)

  • Syslog appender lacks the SocketOptions setting. (LOG4J2-3425)

  • Log4j 1.2 bridge should not wrap components unnecessarily. (LOG4J2-3426)

  • Update 3rd party dependencies for 2.18.0. (LOG4J2-3428)

  • SizeBasedTriggeringPolicy would fail to rename files properly when integer pattern contained a leading zero. (LOG4J2-3432)

  • Fixes default SslConfiguration, when a custom keystore is used. (LOG4J2-3439)

  • Fixes appender concurrency problems in Log4j 1.x bridge. (LOG4J2-3447)

  • Fix and test for race condition in FileUtils.mkdir(). (LOG4J2-3452)

  • LocalizedMessage logs misleading errors on the console. (LOG4J2-3458)

  • Add missing message parameterization in RegexFilter. (LOG4J2-3475)

  • Add the missing context stack to JsonLayout template. (LOG4J2-3477)

  • HttpWatcher did not pass credentials when polling. (LOG4J2-3481)

  • UrlConnectionFactory.createConnection now accepts an AuthorizationProvider as a parameter. (LOG4J2-3482)

  • The DirectWriteRolloverStrategy was not detecting the correct index to use during startup. (LOG4J2-3490)

  • Async Loggers were including the location information by default. (LOG4J2-3491)

  • ClassArbiter’s newBuilder method referenced the wrong class. (LOG4J2-3493)

  • Don’t use Paths.get() to avoid circular file systems. (LOG4J2-3527)

  • Fix parsing error, when XInclude is disabled. (LOG4J2-3531)

  • Fix LevelRangeFilterBuilder to align with log4j1’s behavior. (LOG4J2-3534)

  • Fixes problem with wrong ANSI escape code for bright colors (LOG4J2-3537)

  • Log4j 1.2 bridge should generate Log4j 2.x messages based on the parameter runtime type.

2.17.2

Release date

2022-02-23

This release contains the changes noted below:

  • Over 50 improvements and fixes to the Log4j 1.x support. Continued testing has shown it is a suitable replacement for Log4j 1.x in most cases.

  • Scripting now requires a system property be specified naming the languages the user wishes to allow. The scripting engine will not load if the property isn’t set.

  • By default, the only remote protocol allowed for loading configuration files is HTTPS. Users can specify a system property to allow others or prevent remote loading entirely.

  • Variable resolution has been modified so that only properties defined as properties in the configuration file can be recursive. All other Lookups are now non-recursive. This addresses issues users were having resolving lookups specified in property definitions for use in the RoutingAppender and RollingFileAppender due to restrictions put in place in 2.17.1.

  • Many other fixes and improvements.

Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters. log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and later. SLF4J-2.0.0 alpha releases are not fully supported. See LOG4J2-2975 and SLF4J-511.

The Log4j 2.17.2 API, as well as many core components, maintains binary compatibility with previous releases.

Apache Log4j 2.17.2 requires a minimum of Java 8 to build and run. Log4j 2.12.4 is the last release to support Java 7. Log4j 2.3.2 is the last release to support Java 6. Java 6 and Java 7 are no longer supported by the Log4j team.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Add Configurator.setLevel(Logger, Level), setLevel(String, String), and setLevel(Class, Level).

  • Add org.apache.logging.log4j.core.appender.AsyncAppender.getAppenders() to more easily port from org.apache.log4j.AsyncAppender.getAllAppenders().

  • Require log4j2.Script.enableLanguages to be specified to enable scripting for specific languages. (LOG4J2-2486)

  • Add the log4j-to-jul JDK Logging Bridge (LOG4J2-3282)

  • Limit loading of configuration via a url to https by default. (LOG4J2-3297)

  • Add TB support to FileSize. (LOG4J2-3303)

  • Add shorthand syntax for properties configuration format for specifying a logger level and appender refs. (LOG4J2-3341)

  • Add optional additional fields to NoSQLAppender. (LOG4J2-3391)

Changed

  • Bump Jackson from 2.12.4 to 2.13.1.

  • Bump Mockito from 3.11.2 to 4.2.0.

  • Bump Woodstox 6.2.6 to 6.2.8.

  • Bump awaitility from 4.0.3 to 4.1.1 #663.

  • Bump de.flapdoodle.embed:de.flapdoodle.embed.mongo from 3.0.0 to 3.4.1. Update tests for binary incompatibilities in APIs.

  • Bump maven-compiler-plugin from 3.8.1 to 3.9.0.

  • Bump mongodb3.version from 3.12.4 to 3.12.10 #605.

  • Bump net.javacrumbs.json-unit:json-unit from 2.27.0 to 2.28.0.

  • Bump org.apache.activemq:activemq-broker from 5.16.3 to 5.16.4.

  • Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.3.1 to 3.3.2.

  • Bump org.assertj:assertj-core from 3.20.2 to 3.22.0.

  • Bump org.codehaus.groovy:groovy-* from 3.0.8 to 3.0.9.

  • Bump org.eclipse.persistence:org.eclipse.persistence.jpa from 2.7.9 to 2.7.10.

  • Bump org.fusesource.jansi:jansi from 2.3.4 to 2.4.0.

  • Bump org.jacoco:jacoco-maven-plugin from 0.8.6 to 0.8.7.

  • Bump org.junit.jupiter:junit-* from 5.7.2 to 5.8.2.

  • Bump org.junit-pioneer:junit-pioneer from 1.5.0 to 1.6.1.

  • Bump org.mongodb:bson from 4.2.2 to 4.5.0.

  • Bump org.mongodb:mongodb-driver-sync from 4.2.2 to 4.5.0.

  • Bump org.springframework:spring-* from 5.3.13 to 5.3.15.

  • Bump org.xmlunit:xmlunit-* from 2.8.3 to 2.8.4.

  • Replace usages of "compile" with "implementation" in the Gradle docs. (LOG4J2-3215)

  • Change modifier of method org.apache.logging.log4j.core.tools.Generate#generate to public (was package private) to facilitate automated code generation. (LOG4J2-3267)

  • log4j-jpl formats message parameters correctly using MessageFormat. (LOG4J2-3345)

  • Bump Tomcat from 8.5.20 to 10.0.14 in log4j-appserver along with some dependency clean-up. (LOG4J2-3368)

Fixed

  • Fix DTD error: Add missing ELEMENT for Marker.

  • Fix log4j-jakarta-web service file #723.

  • JndiManager reverts to 2.17.0 behavior: Read the system property for each call.

  • Log4j 1.2 bridge PropertiesConfiguration.buildAppender not adding filters to custom appender. (LOG4J2-3281)

  • Flag LogManager as initialized if the LoggerFactory is provided as a property. (LOG4J2-3304)

  • OptionConverter could cause a StackOverflowError. (LOG4J2-3306)

  • Log4j 1.2 bridge should ignore case in properties file keys. (LOG4J2-3316)

  • Fix RoutingAppender backward compatibility and disallow recursive evaluation of lookup results outside of configuration properties. (LOG4J2-3317)

  • Log4j 1.2 bridge class org.apache.log4j.spi.LoggingEvent missing constructors and public instance variable. (LOG4J2-3326)

  • Log4j 1.2 bridge fixes parsing filters in properties configuration file #680. (LOG4J2-3326)

  • Log4j 1.2 bridge missing OptionConverter.instantiateByKey(Properties, String, Class, Object). (LOG4J2-3326)

  • Log4j 1.2 bridge does not support system properties in log4j.xml. (LOG4J2-3328)

  • Configurator.setLevel not fetching the correct LoggerContext. (LOG4J2-3330)

  • Fix ThreadContextDataInjector initialization deadlock (LOG4J2-3333)

  • Fix substitutions when programmatic configuration is used (LOG4J2-3358)

  • AppenderLoggingException logging any exception to a MongoDB Appender. (LOG4J2-3392)

  • Possible NullPointerException in MongoDb4DocumentObject, MongoDbDocumentObject, DefaultNoSqlObject. (LOG4J2-3392)

  • Fix DefaultConfiguration leak in PatternLayout (LOG4J2-3404)

  • Document that the Spring Boot Lookup requires the log4j-spring-boot dependency. (LOG4J2-3405)

  • Log4j 1.2 bridge Check for non-existent appender when parsing properties #761. (LOG4J2-3407)

  • Log4j 1.2 bridge supports global threshold #764. (LOG4J2-3407)

  • Log4j 1.2 bridge throws a ClassCastException when logging a Map with non-String keys. (LOG4J2-3410)

  • Log4j 1.2 bridge adds org.apache.log4j.Hierarchy.

  • Log4j 1.2 bridge adds org.apache.log4j.component.helpers.Constants.

  • Log4j 1.2 bridge adds org.apache.log4j.helpers.Loader.

  • Log4j 1.2 bridge adds org.apache.log4j.helpers.LogLog.

  • Log4j 1.2 bridge adds org.apache.log4j.spi.DefaultRepositorySelector.

  • Log4j 1.2 bridge adds org.apache.log4j.spi.NOPLoggerRepository and NOPLogger.

  • Log4j 1.2 bridge adds org.apache.log4j.spi.RootLogger.

  • Log4j 1.2 bridge class Category is missing some protected instance variables.

  • Log4j 1.2 bridge class Category should implement AppenderAttachable.

  • Log4j 1.2 bridge class ConsoleAppender should extend WriterAppender and provide better compatibility with custom appenders.

  • Log4j 1.2 bridge class LogManager default constructor should be public.

  • Log4j 1.2 bridge class OptionConverter is missing selectAndConfigure() methods.

  • Log4j 1.2 bridge class PatternLayout is missing constants DEFAULT_CONVERSION_PATTERN and TTCC_CONVERSION_PATTERN.

  • Log4j 1.2 bridge class PropertyConfigurator should implement Configurator.

  • Log4j 1.2 bridge creates a SocketAppender instead of a SyslogAppender.

  • Log4j 1.2 bridge implements LogManager.getCurrentLoggers() fully.

  • Log4j 1.2 bridge implements most of DOMConfigurator.

  • Log4j 1.2 bridge interface Configurator doConfigure() methods should use LoggerRepository, not LoggerContext.

  • Log4j 1.2 bridge interface org.apache.log4j.spi.RendererSupport was in the wrong package and incomplete.

  • Log4j 1.2 bridge interfaces missing from package org.apache.log4j.spi: ThrowableRenderer, ThrowableRendererSupport, TriggeringEventEvaluator.

  • Log4j 1.2 bridge issues with filters #753.

  • Log4j 1.2 bridge method Category.exists(String) should be static.

  • Log4j 1.2 bridge method NDC.inherit(Stack) should not use generics to provide source compatibility.

  • Log4j 1.2 bridge methods Category.getChainedPriority() and getEffectiveLevel() should not be final.

  • Log4j 1.2 bridge methods missing in org.apache.log4j.Category: getDefaultHierarchy(), getHierarchy(), getLoggerRepository().

  • Log4j 1.2 bridge missed

  • Log4j 1.2 bridge missed org.apache.log4j.pattern.FormattingInfo.

  • Log4j 1.2 bridge missed org.apache.log4j.pattern.NameAbbreviator.

  • Log4j 1.2 bridge missing DefaultThrowableRenderer.

  • Log4j 1.2 bridge missing FormattingInfo.

  • Log4j 1.2 bridge missing PatternConverter.

  • Log4j 1.2 bridge missing PatternParser.

  • Log4j 1.2 bridge missing UtilLoggingLevel.

  • Log4j 1.2 bridge missing class org.apache.log4j.or.RendererMap.

  • Log4j 1.2 bridge missing some LocationInfo constructors.

  • Log4j 1.2 bridge missing some ThrowableInformation constructors.

  • Log4j 1.2 bridge now logs a warning instead of throwing an NullPointerException when building a Syslog appender with a missing "SyslogHost" param.

  • Log4j 1.2 bridge should allow property and XML attributes to start with either an upper-case or lower-case letter.

  • Log4j 1.2 bridge supports the SocketAppender.

  • Log4j 1.2 bridge throws ClassCastException when using SimpleLayout and others #708.

  • Log4j 1.2 bridge uses some incorrect default property values in some appenders.

  • Log4j 1.2 bridge uses the wrong default values for a TTCCLayout #709.

  • Log4j 1.2 bridge uses the wrong file pattern for rolling file appenders #710.

  • Trim whitespace before parsing a String into an Integer.

2.17.1

Release date

2021-12-27

This release addresses CVE-2021-44832 and contains other minor fixes.

Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters. log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and later. SLF4J-2.0.0 alpha releases are not fully supported. See LOG4J2-2975 and SLF4J-511.

The Log4j 2.17.1 API, as well as many core components, maintains binary compatibility with previous releases.

Apache Log4j 2.17.1 requires a minimum of Java 8 to build and run. Log4j 2.12.2 is the last release to support Java 7. Java 7 is no longer supported by the Log4j team.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Fixed

  • Fix NPE when input is null in StrSubstitutor.replace(String, Properties).

  • Correct SpringLookup package name in Interpolator. (LOG4J2-3204)

  • Reduce ignored package scope of KafkaAppender. (LOG4J2-3256)

  • Fix MapLookup to lookup MapMessage before DefaultMap (LOG4J2-3264)

  • Lookups with no prefix only read values from the configuration properties as expected. (LOG4J2-3270)

  • Buffered I/O checked had inverted logic in RollingFileAppenderBuilder. (LOG4J2-3274)

  • log4j-to-slf4j takes the provided MessageFactory into account (LOG4J2-3284)

  • log4j-to-slf4j no longer re-interpolates formatted message contents. (LOG4J2-3289)

  • Remove unused method. (LOG4J2-3290)

  • ExtendedLoggerWrapper.logMessage no longer double-logs when location is requested. (LOG4J2-3292)

  • JdbcAppender now uses JndiManager to access JNDI resources. JNDI is only enabled when system property log4j2.enableJndiJdbc is set to true. (LOG4J2-3293)

2.17.0

Release date

2021-12-17

The major changes contained in this release include:

  • Address CVE-2021-45105 by disabling recursive evaluation of Lookups during log event processing. Recursive evaluation is still allowed while generating the configuration.

  • The JndiLookup, JndiContextSelector, and JMSAppender now require individual system properties to be enabled.

  • Remove LDAP and LDAPS as supported protocols from JNDI.

The single log4j2.enableJndi property introduced in Log4j 2.16.0 has been replaced with three individual properties; log4j2.enableJndiContextSelector, log4j2.enableJndiJms, and log4j2.enableJndiLookup.

The Log4j 2.17.0 API, as well as many core components, maintains binary compatibility with previous releases.

Apache Log4j 2.17.0 requires a minimum of Java 8 to build and run. Log4j 2.12.2 is the last release to support Java 7. Java 7 is no longer supported by the Log4j team.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Fixed

  • Fix string substitution recursion. (LOG4J2-3230)

  • Log4j 1.2 bridge API hard codes the Syslog protocol to TCP. (LOG4J2-3237)

  • Do not declare log4j-api-java9 and log4j-core-java9 as dependencies as it causes problems with the Maven enforcer plugin. (LOG4J2-3241)

  • Limit JNDI to the java protocol only. JNDI will remain disabled by default. Rename JNDI enablement property from 'log4j2.enableJndi' to 'log4j2.enableJndiLookup', 'log4j2.enableJndiJms', and 'log4j2.enableJndiContextSelector'. (LOG4J2-3242)

  • PropertiesConfiguration.parseAppenderFilters NPE when parsing properties file filters. (LOG4J2-3247)

  • Log4j 1.2 bridge for Syslog Appender defaults to port 512 instead of 514. (LOG4J2-3249)

2.16.0

Release date

2021-12-13

This release contains one change which is noted below.

Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters. log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and later. SLF4J-2.0.0 alpha releases are not fully supported. See LOG4J2-2975 and SLF4J-511.

Some of the changes in Log4j 2.16.0 include:

  • Removed Message Lookups. This is a hardening related to changes made to prevent CVE-2021-44228. While this change is recommended, it is NOT required to fix CVE-2021-44228.

  • While release 2.15.0 removed the ability to resolve Lookups and log messages and addressed issues with how JNDI is accessed, the Log4j team feels that having JNDI enabled by default introduces an undue risk for our users. Starting in version 2.16.0, JNDI functionality is disabled by default and can be re-enabled via the log4j2.enableJndi system property. Use of JNDI in an unprotected context is a large security risk and should be treated as such in both this library and all other Java libraries using JNDI.

  • Prior to version 2.15.0, Log4j would automatically resolve Lookups contained in the message or its parameters in the Pattern Layout. This behavior is no longer the default and must be enabled by specifying %msg{lookup}.

The Log4j 2.16.0 API, as well as many core components, maintains binary compatibility with previous releases.

Apache Log4j 2.16.0 requires a minimum of Java 8 to build and run. Log4j 2.12.1 is the last release to support Java 7. Java 7 is no longer supported by the Log4j team.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Fixed

  • Disable JNDI by default. Require log4j2.enableJndi to be set to true to allow JNDI. (LOG4J2-3208)

  • Completely remove support for Message Lookups. (LOG4J2-3211)

2.15.0

Release date

2021-12-06

This release contains a number of bug fixes and minor enhancements which are listed below.

The Log4j team has been made aware of a security vulnerability, CVE-2021-44228, that has been addressed in Log4j 2.15.0.

Log4j’s JNDI support has not restricted what names could be resolved. Some protocols are unsafe or can allow remote code execution. Log4j now limits the protocols by default to only java, ldap, and ldaps and limits the ldap protocols to only accessing Java primitive objects by default served on the local host.

One vector that allowed exposure to this vulnerability was Log4j’s allowance of Lookups to appear in log messages. As of Log4j 2.15.0 this feature is now disabled by default. While an option has been provided to enable Lookups in this fashion, users are strongly discouraged from enabling it.

Users who cannot upgrade to 2.15.0 can mitigate the exposure by:

  1. Users of Log4j 2.10 or greater may add -Dlog4j.formatMsgNoLookups=true as a command line option or add log4j.formatMsgNoLookups=true to a log4j2.component.properties file on the classpath to prevent lookups in log event messages.

  2. Users since Log4j 2.7 may specify %{nolookups} in the PatternLayout configuration to prevent lookups in log event messages.

  3. Remove the JndiLookup and JndiManager classes from the log4j-core JAR. Removal of the JndiManager will cause the JndiContextSelector and JMSAppender to no longer function.

Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters. log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and later. SLF4J-2.0.0 alpha releases are not fully supported. See LOG4J2-2975 and SLF4J-511.

Some of the new features in Log4j 2.15.0 include:

  • Support for Arbiters, which are conditionals that can enable sections of the logging configuration for inclusion or exclusion. In particular, SpringProfile, SystemProperty, Script, and Class Arbiters have been provided that use the Spring profile, System property, the result of a script, or the presence of a class respectively to determine whether a section of configuration should be included.

  • Support for Jakarta EE 9. This is functionally equivalent to Log4j’s log4j-web module but uses the Jakarta project.

  • Various performance improvements.

Key changes to note:

  • Prior to this release Log4j would automatically resolve Lookups contained in the message or its parameters in the Pattern Layout. This behavior is no longer the default and must be enabled by specifying %msg{lookup}.

  • The JNDI Lookup has been restricted to only support the java, ldap, and ldaps protocols by default. LDAP also no longer supports classes that implement the Referenceable interface and restricts the Serializable classes to the Java primitive classes by default and requires an allow list to be specified to access remote LDAP servers.

The Log4j 2.15.0 API, as well as many core components, maintains binary compatibility with previous releases.

Apache Log4j 2.15.0 requires a minimum of Java 8 to build and run. Log4j 2.12.1 is the last release to support Java 7. Java 7 is no longer supported by the Log4j team.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Add support for US-style date patterns and micro/nano seconds to FixedDateTime. (LOG4J2-2885)

  • Add BasicAsyncLoggerContextSelector equivalent to AsyncLoggerContextSelector for applications with a single LoggerContext. This selector avoids classloader lookup overhead incurred by the existing AsyncLoggerContextSelector. (LOG4J2-2940)

  • Context selectors are aware of their dependence upon the callers ClassLoader, allowing basic context selectors to avoid the unnecessary overhead of walking the stack to determine the caller’s ClassLoader. (LOG4J2-2940)

  • Add support for Jakarta EE 9 (Tomcat 10 / Jetty 11) (LOG4J2-2978)

  • Add plugin support to JsonTemplateLayout. (LOG4J2-3004)

  • Allow a PatternSelector to be specified on GelfLayout. (LOG4J2-3041)

  • Add RepeatPatternConverter. (LOG4J2-3044)

  • Add improved MapMessage support to GelfLayout. (LOG4J2-3048)

  • Allow MapMessage and ThreadContext attributes to be prefixed. (LOG4J2-3049)

  • Allow AdditionalFields to be ignored if their value is null or a zero-length String. (LOG4J2-3050)

  • Add CaseConverterResolver to JsonTemplateLayout. (LOG4J2-3051)

  • Refactor MD5 usage for sharing sensitive information. (LOG4J2-3056)

  • Add Arbiters and SpringProfile plugin. (LOG4J2-3064)

  • Add CounterResolver to JsonTemplateLayout. (LOG4J2-3067)

  • Add replacement parameter to ReadOnlyStringMapResolver. (LOG4J2-3074)

  • Add JsonTemplateLayout for Google Cloud Platform structured logging layout. (LOG4J2-3116)

  • Add missing slf4j-api singleton accessors to log4j-slf4j-impl (1.7) StaticMarkerBinder and StaticMDCBinder. This doesn’t impact behavior or correctness, but avoids throwing and catching NoSuchMethodErrors when slf4j is initialized and avoids linkage linting warnings. (LOG4J2-3133)

  • Avoid ThreadLocal overhead in RandomAccessFileAppender, RollingRandomAccessFileManager, and MemoryMappedFileManager due to the unused setEndOfBatch and isEndOfBatch methods. The methods on LogEvent are preferred. (LOG4J2-3141)

  • Prefer string.getBytes(Charset) over string.getBytes(String) based on performance improvements in modern Java releases. (LOG4J2-3144)

  • Make CRLF/HTML encoding run in O(n) worst-case time, rather than O(n^2). (LOG4J2-3170)

  • Improve PatternLayout performance by reducing unnecessary indirection and branching. (LOG4J2-3171)

  • Improve NameAbbreviator worst-case performance. (LOG4J2-3189)

  • Allow fractional attributes for size attribute of SizeBasedTriggeringPolicy. (LOG4J2-3194)

  • Pattern layout no longer enables lookups within message text by default for cleaner API boundaries and reduced formatting overhead. The old 'log4j2.formatMsgNoLookups' which enabled this behavior has been removed as well as the 'nolookups' message pattern converter option. The old behavior can be enabled on a per-pattern basis using '%m{lookups}'. (LOG4J2-3198)

Changed

  • Handle interrupted exceptions that occur during rollover. (LOG4J2-1798)

  • Provide support for overriding the Tomcat Log class in Tomcat 8.5+. (LOG4J2-2025)

  • Minor documentation corrections regarding log levels. (LOG4J2-2540)

  • Minor documentation corrections in the configuration section. (LOG4J2-2541)

  • Correct documentation for SyslogAppender when using TLS. (LOG4J2-2553)

  • Log4j 1.x properties were not being substituted. (LOG4J2-2951)

  • Fix Log Event Level vs Logger Config Level table. (LOG4J2-3166)

  • Update Spring framework to 5.3.13, Spring Boot to 2.5.7, and Spring Cloud to 2020.0.4.

  • Updated dependencies. - com.fasterxml.jackson.core:jackson-annotations …​…​…​…​…​.. 2.12.2 → 2.12.4 - com.fasterxml.jackson.core:jackson-core …​…​…​…​…​…​…​…​ 2.12.2 → 2.12.4 - com.fasterxml.jackson.core:jackson-databind …​…​…​…​…​…​.. 2.12.2 → 2.12.4 - com.fasterxml.jackson.dataformat:jackson-dataformat-xml …​…​.. 2.12.2 → 2.12.4 - com.fasterxml.jackson.dataformat:jackson-dataformat-yaml …​…​. 2.12.2 → 2.12.4 - com.fasterxml.jackson.module:jackson-module-jaxb-annotations …​ 2.12.2 → 2.12.4 - com.fasterxml.woodstox:woodstox-core …​…​…​…​…​…​…​…​…​ 6.2.4 → 6.2.6 - commons-io:commons-io …​…​…​…​…​…​…​…​…​…​…​…​…​…​ 2.8.0 → 2.11.0 - net.javacrumbs.json-unit:json-unit …​…​…​…​…​…​…​…​…​.. 2.24.0 → 2.25.0 - net.javacrumbs.json-unit:json-unit …​…​…​…​…​…​…​…​…​.. 2.25.0 → 2.27.0 - org.apache.activemq:activemq-broker …​…​…​…​…​…​…​…​…​. 5.16.1 → 5.16.2 - org.apache.activemq:activemq-broker …​…​…​…​…​…​…​…​…​. 5.16.2 → 5.16.3 - org.apache.commons:commons-compress …​…​…​…​…​…​…​…​…​. 1.20 → 1.21 - org.apache.commons:commons-csv …​…​…​…​…​…​…​…​…​…​…​ 1.8 → 1.9.0 - org.apache.commons:commons-dbcp2 …​…​…​…​…​…​…​…​…​…​. 2.8.0 → 2.9.0 - org.apache.commons:commons-pool2 …​…​…​…​…​…​…​…​…​…​. 2.9.0 → 2.11.1 - org.apache.maven.plugins:maven-failsafe-plugin …​…​…​…​…​.. 2.22.2 → 3.0.0-M5 - org.apache.maven.plugins:maven-surefire-plugin …​…​…​…​…​.. 2.22.2 → 3.0.0-M5 - org.apache.rat:apache-rat-plugin …​…​…​…​…​…​…​…​…​…​. 0.12 → 0.13 - org.assertj:assertj-core …​…​…​…​…​…​…​…​…​…​…​…​…​ 3.19.0 → 3.20.2 - org.codehaus.groovy:groovy-dateutil …​…​…​…​…​…​…​…​…​. 3.0.7 → 3.0.8 - org.codehaus.groovy:groovy-jsr223 …​…​…​…​…​…​…​…​…​…​ 3.0.7 → 3.0.8 - org.codehaus.plexus:plexus-utils …​…​…​…​…​…​…​…​…​…​. 3.3.0 → 3.4.0 - org.eclipse.persistence:javax.persistence …​…​…​…​…​…​…​. 2.1.1 → 2.2.1 - org.eclipse.persistence:org.eclipse.persistence.jpa …​…​…​…​ 2.6.5 → 2.6.9 - org.eclipse.persistence:org.eclipse.persistence.jpa …​…​…​…​ 2.7.8 → 2.7.9 - org.fusesource.jansi …​…​…​…​…​…​…​…​…​…​…​…​…​…​. 2.3.2 → 2.3.4 - org.fusesource.jansi:jansi …​…​…​…​…​…​…​…​…​…​…​…​. 2.3.1 → 2.3.2 - org.hsqldb:hsqldb …​…​…​…​…​…​…​…​…​…​…​…​…​…​…​. 2.5.1 → 2.5.2 - org.junit.jupiter:junit-jupiter-engine …​…​…​…​…​…​…​…​. 5.7.1 → 5.7.2 - org.junit.jupiter:junit-jupiter-migrationsupport …​…​…​…​…​ 5.7.1 → 5.7.2 - org.junit.jupiter:junit-jupiter-params …​…​…​…​…​…​…​…​. 5.7.1 → 5.7.2 - org.junit.vintage:junit-vintage-engine …​…​…​…​…​…​…​…​. 5.7.1 → 5.7.2 - org.liquibase:liquibase-core …​…​…​…​…​…​…​…​…​…​…​.. 3.5.3 → 3.5.5 - org.mockito:mockito-core …​…​…​…​…​…​…​…​…​…​…​…​…​ 3.8.0 → 3.11.2 - org.mockito:mockito-junit-jupiter …​…​…​…​…​…​…​…​…​…​ 3.8.0 → 3.11.2 - org.springframework:spring-aop …​…​…​…​…​…​…​…​…​…​…​ 5.3.3 → 5.3.9 - org.springframework:spring-beans …​…​…​…​…​…​…​…​…​…​. 5.3.3 → 5.3.9 - org.springframework:spring-context …​…​…​…​…​…​…​…​…​.. 5.3.3 → 5.3.9 - org.springframework:spring-context-support …​…​…​…​…​…​…​ 5.3.3 → 5.3.9 - org.springframework:spring-core …​…​…​…​…​…​…​…​…​…​.. 5.3.3 → 5.3.9 - org.springframework:spring-expression …​…​…​…​…​…​…​…​.. 5.3.3 → 5.3.9 - org.springframework:spring-oxm …​…​…​…​…​…​…​…​…​…​…​ 5.3.3 → 5.3.9 - org.springframework:spring-test …​…​…​…​…​…​…​…​…​…​.. 5.3.3 → 5.3.9 - org.springframework:spring-web …​…​…​…​…​…​…​…​…​…​…​ 5.3.3 → 5.3.9 - org.springframework:spring-webmvc …​…​…​…​…​…​…​…​…​…​ 5.3.3 → 5.3.9 - org.tukaani:xz …​…​…​…​…​…​…​…​…​…​…​…​…​…​…​…​. 1.8 → 1.9

Fixed

  • LoggerContext skips resolving localhost when hostName is configured. (LOG4J2-2808)

  • Handle Disruptor event translation exceptions. (LOG4J2-2816)

  • SocketAppender should propagate failures when reconnection fails. (LOG4J2-2829)

  • Slf4j implementations walk the stack at most once rather than twice to determine the caller’s class loader. (LOG4J2-2940)

  • Fixed a deadlock between the AsyncLoggerContextSelector and java.util.logging.LogManager by updating Disruptor to 3.4.4. (LOG4J2-2965)

  • BasicContextSelector hasContext and shutdown take the default context into account (LOG4J2-3054)

  • Fix thread-safety issues in DefaultErrorHandler. (LOG4J2-3060)

  • Ensure EncodingPatternConverter#handlesThrowable is implemented. (LOG4J2-3070)

  • Fix formatting of nanoseconds in JsonTemplateLayout. (LOG4J2-3075)

  • Use SimpleMessage in Log4j 1 Category whenever possible. (LOG4J2-3080)

  • log4j-slf4j-impl and log4j-slf4j18-impl correctly detect the calling class using both LoggerFactory.getLogger methods as well as LoggerFactory.getILoggerFactory().getLogger. (LOG4J2-3083)

  • Fix race in JsonTemplateLayout where a timestamp could end up unquoted. (LOG4J2-3087)

  • Fix sporadic JsonTemplateLayoutNullEventDelimiterTest failures on Windows. (LOG4J2-3089)

  • Fix JsonWriter memory leaks due to retained excessive buffer growth. (LOG4J2-3092)

  • Category.setLevel should accept null value. (LOG4J2-3095)

  • Fix a regression in 2.14.1 which allowed the AsyncAppender background thread to keep the JVM alive because the daemon flag was not set. (LOG4J2-3102)

  • Fix race condition which can result in ConcurrentModificationException on context.stop. (LOG4J2-3103)

  • SmtpManager.createManagerName ignores port. (LOG4J2-3107)

  • Fix the number of {}-placeholders in the string literal argument does not match the number of other arguments to the logging call. (LOG4J2-3110)

  • Enable immediate flush on RollingFileAppender when buffered i/o is not enabled. (LOG4J2-3114)

  • log4j2 config modified at run-time may trigger incomplete MBean re-initialization due to InstanceAlreadyExistsException. (LOG4J2-3121)

  • log4j-1.2-api implements LogEventAdapter.getTimestamp() based on the original event timestamp instead of returning zero. (LOG4J2-3142)

  • RandomAccessFile appender uses the correct default buffer size of 256 kB rather than the default appender buffer size of 8 kB. (LOG4J2-3150)

  • DatePatternConverter performance is not impacted by microsecond-precision clocks when such precision isn’t required. (LOG4J2-3153)

  • Fixed an unlikely race condition in Log4jMarker.getParents() volatile access. (LOG4J2-3159)

  • Fix documentation on how to toggle log4j2.debug system property. (LOG4J2-3160)

  • Fix bug when file names contain regex characters. (LOG4J2-3168)

  • Buffer immutable log events in the SmtpManager. (LOG4J2-3172)

  • Wrong subject on mail when it depends on the LogEvent (LOG4J2-3174)

  • Avoid KafkaManager override when topics differ. (LOG4J2-3175)

  • Avoid using MutableInstant of the event as a cache key in JsonTemplateLayout. (LOG4J2-3183)

  • Fix thread-safety issues in DefaultErrorHandler. (LOG4J2-3185)

  • Limit the protocols JNDI can use by default. Limit the servers and classes that can be accessed via LDAP. (LOG4J2-3201)

2.14.1

Release date

2021-03-06

This release contains a number of bug fixes and minor enhancements which are listed below.

Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters. log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and later.

The Log4j 2.14.1 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.14.1 requires a minimum of Java 8 to build and run. Log4j 2.12.1 is the last release to support Java 7.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Enrich "map" resolver by unifying its backend with "mdc" resolver. (LOG4J2-2962)

  • Support stack trace truncation in JsonTemplateLayout. (LOG4J2-2993)

  • Replace JsonTemplateLayout resolver configurations table in docs with sections. (LOG4J2-2999)

Changed

  • Allow reconfiguration when Log4j 1 configuration files are updated. (LOG4J2-2893)

  • Add Rollover Listener to aid in unit test validation. (LOG4J2-2923)

  • Replace outdated PatternLayout.createLayout() calls in docs with createDefaultLayout(). (LOG4J2-2977)

  • Update JSON Unit 2.21.0 → 2.22.0.

  • Update JaCoCo 0.8.3 → 0.8.6.

  • Update Mockito 3.6.0 → 3.7.0.

  • Update MongoDB 3 plugin: org.mongodb:mongodb-driver 3.12.6 → 3.12.7.

  • Update MongoDB 4 plugin: org.mongodb:* 4.1.0 → 4.1.1.

  • Update Spring dependencies to 5.3.2, Spring Boot to 2.3.6, and Spring Cloud to Hoxton.SR9

  • Update Woodstox 5.0.3 → 6.2.3 to match Jackson 2.12.1.

  • Update XML Unit 2.8.0 → 2.8.2.

  • Update com.fasterxml.jackson.: 2.11.2 - 2.11.3.

  • Update commons-codec:commons-codec 1.14 → 1.15.

  • Update commons-io:commons-io 2.7 → 2.8.0.

  • Update de.flapdoodle.embed:de.flapdoodle.embed.mongo 2.2.0 → 3.0.0.

  • Update junit:junit 4.13 → 4.13.1.

  • Update mongodb4.version 4.1.1 → 4.2.0.

  • Update net.javacrumbs.json-unit:json-unit 1.31.1 → 2.22.0.

  • Update net.javacrumbs.json-unit:json-unit 2.22.0 → 2.23.0.

  • Update org.apache.activemq:* 5.16.0 → 5.16.1.

  • Update org.apache.commons:commons-dbcp2 2.4.0 → 2.8.0.

  • Update org.apache.commons:commons-lang3 3.10 → 3.11.

  • Update org.apache.commons:commons-pool2 2.8.1 → 2.9.0.

  • Update org.assertj:assertj-core 3.14.0 → 3.18.1.

  • Update org.assertj:assertj-core 3.18.1 → 3.19.0.

  • Update org.awaitility:awaitility 4.0.2 → 4.0.3.

  • Update org.codehaus.groovy:* 3.0.5 → 3.0.6.

  • Update org.codehaus.plexus:plexus-utils 3.2.0 → 3.3.0.

  • Update org.eclipse.tycho:org.eclipse.osgi 3.12.1.v20170821-1548 → 3.13.0.v20180226-1711.

  • Update org.fusesource.jansi:jansi 1.17.1 → 2.0.1.

  • Update org.fusesource.jansi:jansi 1.18 → 2.2.0.

  • Update org.fusesource.jansi:jansi 1.18 → 2.3.1.

  • Update org.mockito:mockito-* 3.7.0 → 3.7.7.

  • Update org.springframework:* 5.2.8.RELEASE → 5.3.1.

  • Update org.springframework:* 5.3.2 → 5.3.3.

  • Update org.xmlunit:* 2.7.0 → 2.8.0.

  • - com.fasterxml.jackson.core:jackson-annotations …​…​…​…​…​.. 2.12.1 → 2.12.2 - com.fasterxml.jackson.core:jackson-core …​…​…​…​…​…​…​…​ 2.12.1 → 2.12.2 - com.fasterxml.jackson.core:jackson-databind …​…​…​…​…​…​.. 2.12.1 → 2.12.2 - com.fasterxml.jackson.dataformat:jackson-dataformat-xml …​…​.. 2.12.1 → 2.12.2 - com.fasterxml.jackson.dataformat:jackson-dataformat-yaml …​…​. 2.12.1 → 2.12.2 - com.fasterxml.jackson.module:jackson-module-jaxb-annotations …​ 2.12.1 → 2.12.2 - org.apache.commons:commons-lang3 …​…​…​…​…​…​…​…​…​…​. 3.11 → 3.12.0 - org.junit.jupiter:junit-jupiter-engine …​…​…​…​…​…​…​…​. 5.7.0 → 5.7.1 - org.junit.jupiter:junit-jupiter-migrationsupport …​…​…​…​…​ 5.7.0 → 5.7.1 - org.junit.jupiter:junit-jupiter-params …​…​…​…​…​…​…​…​. 5.7.0 → 5.7.1 - org.junit.vintage:junit-vintage-engine …​…​…​…​…​…​…​…​. 5.7.0 → 5.7.1 - org.mockito:mockito-core …​…​…​…​…​…​…​…​…​…​…​…​…​ 3.7.7 → 3.8.0 - org.mockito:mockito-junit-jupiter …​…​…​…​…​…​…​…​…​…​ 3.7.7 → 3.8.0 - org.mongodb:bson …​…​…​…​…​…​…​…​…​…​…​…​…​…​…​.. 4.2.0 → 4.2.2 - org.mongodb:mongodb-driver-sync …​…​…​…​…​…​…​…​…​…​.. 4.2.0 → 4.2.2

Fixed

  • Allow auto-shutdown of log4j in log4j-web to be turned off and provide a ServletContextListener "Log4jShutdownOnContextDestroyedListener" to stop log4j. Register the listener at the top of web.xml to ensure the shutdown happens last. (LOG4J2-1606)

  • Allow auto-shutdown of log4j in log4j-web to be turned off and provide a ServletContextListener "Log4jShutdownOnContextDestroyedListener" to stop log4j. Register the listener at the top of web.xml to ensure the shutdown happens last. (LOG4J2-2624)

  • Avoid redundant Kafka producer instantiation causing thread leaks. (LOG4J2-2916)

  • Document that LogBuilder default methods do nothing. (LOG4J2-2947)

  • Replace HashSet with IdentityHashMap in ParameterFormatter to detect cycles. (LOG4J2-2948)

  • Fix reading of JsonTemplateLayout event additional fields from config. (LOG4J2-2961)

  • Merge packages from several Configurations in Composite Configuration. (LOG4J2-2964)

  • Fix JsonTemplateLayout index based parameter resolution when messages contain too few parameters. (LOG4J2-2967)

  • Refactor AsyncAppender and AppenderControl for handling of Throwables. (LOG4J2-2972)

  • Rename EventTemplateAdditionalField#type (conflicting with properties file parser) to "format". (LOG4J2-2973)

  • Log4j would fail to initialize in Java 8 with log4j-spring-boot. (LOG4J2-2974)

  • JdbcAppender composes an incorrect INSERT statement without a ColumnMapping element. (LOG4J2-2976)

  • OnStartupTriggeringPolicy would fail to cause the file to roll over with DirectWriteTriggeringPolicy unless minSize was set to 0. (LOG4J2-2981)

  • Add eventTemplateRootObjectKey parameter to JsonTemplateLayout. (LOG4J2-2985)

  • Reduce garbage by using putAll when copying the ThreadContext for SLF4J. (LOG4J2-2990)

  • Fix truncation of excessive strings ending with a high surrogate in JsonWriter. (LOG4J2-2998)

  • Directly create a thread instead of using the common ForkJoin pool when initializing ThreadContextDataInjector" (LOG4J2-3006)

  • Log4j1ConfigurationConverter on Windows produces " " at end of every line. (LOG4J2-3014)

  • OutputStreamManager.flushBuffer always resets the buffer, previously the buffer was not reset after an exception. (LOG4J2-3028)

  • Add log method with no parameters - i.e. it has an empty message. (LOG4J2-3033)

  • Attempting to call getExtendedStackTraceAsString() after deserializing JSON LogEvent results in a NPE. (LOG4J2-3131)

  • NoGcLayout allocates empty bytes arrays for its header and footer. (LOG4J2-3131)

2.14.0

Release date

2020-11-06

This release contains a new Layout, JsonTemplateLayout, that is intended to ultimately replace JsonLayout. As its name suggests it uses a template to define the elements to include in the JSON. This Layout was contributed by the author of the log4j2-logstash-layout, and who is now a member of the Log4j community.

Log4j 2.14.0 adds support for MongoDB 4 and removes support for MongoDB 2.

This release also contains a number of bug fixes which are listed below.

Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters. log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and later.

The Log4j 2.14.0 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.14.0 requires a minimum of Java 8 to build and run. Log4j 2.12.1 is the last release to support Java 7.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Create module log4j-mongodb4 to use new major version 4 MongoDB driver. (LOG4J2-2848)

  • More flexible configuration of the Disruptor WaitStrategy. (LOG4J2-2858)

  • Add JsonTemplateLayout. (LOG4J2-2957)

Changed

  • Add date pattern support for HTML layout. (LOG4J2-2889)

  • Allow GelfLayout to produce newline delimited events. (LOG4J2-2892)

  • Update MongoDB tests to require Java 8 unconditionally now that Log4j requires Java 8.

  • Update com.fasterxml.jackson.* 2.10.2 → 2.11.0.

  • Update jackson 2.11.0 → 2.11.2.

  • Update mongodb3.version from 3.12.1 to 3.12.6.

  • Update org.apache.activemq:activemq-broker 5.15.11 → 5.16.0.

  • Update org.apache.commons:commons-compress 1.19 → 1.20.

  • Update org.apache.commons:commons-csv 1.7 → 1.8.

  • Update org.apache.commons:commons-lang3 3.9 → 3.10.

  • Update org.codehaus.groovy:* 2.5.6 → 3.0.5.

  • Update tests commons-io:commons-io 2.6 → 2.7.

  • Update tests hsqldb 2.5.0 → 2.5.1.

  • Update tests junit:junit 4.12 → 4.13.

Fixed

  • Javadoc link in ThreadContext description was incorrect. (LOG4J2-2822)

  • Correct class name printed in error message in RollingFileAppender. (LOG4J2-2832)

  • Disruptor and JUL no longer recursively start the AsyncLoggerDisruptor resulting in an extra disruptor background thread constantly waiting. (LOG4J2-2837)

  • Null pointer exception when no network interfaces are available. (LOG4J2-2844)

  • Fixed typos where mergeFactory should be mergeStrategy. (LOG4J2-2859)

  • Obtain ContextDataProviders asynchronously. (LOG4J2-2867)

  • RingBufferLogEventTranslator uses a static ContextDataInjector instead of initializing a new object on each thread. (LOG4J2-2867)

  • Rollover was failing to create directories when using a DirectFileRolloverStrategy. (LOG4J2-2875)

  • Determine the container id to obtain container and image information. (LOG4J2-2877)

  • Create StackWalker benchmark. Revert back to StackWalker.walk based on benchmark results. (LOG4J2-2880)

  • Support java.util.logging filters when using that API. (LOG4J2-2882)

  • When using DirectFileRolloverStrategy the file pattern was not being recalculated on size based rollover after a time based rollover had occurred. (LOG4J2-2883)

  • Fix spelling error in log message. (LOG4J2-2894)

  • Fix potential deadlock in asynchronous logging by avoiding blocking for queue space on Log4jThreads (LOG4J2-2895)

  • Avoid initializing volatile fields with default values. (LOG4J2-2898)

  • Fix log4j-1.2-api LogEventWrapper threadId and priority accessors when called multiple times. (LOG4J2-2899)

  • Missing configuration files should be ignored when creating a composite configuration. (LOG4J2-2901)

  • Fix UnsupportedOperationException when initializing the Log4j2CloudConfigLoggingSystem. (LOG4J2-2906)

  • Move Spring Lookup and Spring PropertySource to its own module. (LOG4J2-2908)

  • Log4j-web should now store the servlet context as a map entry instead of in the single external context field. (LOG4J2-2910)

  • Log4j2EventListener in spring.cloud.config.client listens for wrong event. (LOG4J2-2911)

  • Call ReliabilityStrategy’s beforeStopAppenders() method before stopping AsyncAppender. (LOG4J2-2919)

  • Fix broken link in FAQ. (LOG4J2-2925)

  • Fix NPE in MDCContextMap on 'contains' and 'isEmpty' invocations. (LOG4J2-2939)

  • Prevent premature garbage collection of shutdown hooks in DefaultShutdownCallbackRegistry. (LOG4J2-2954)

Removed

2.13.3

Release date

2020-05-10

This release contains a fix for bug LOG4J2-2838.

Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters. log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and later.

Note that the XML, JSON and YAML formats changed in the 2.11.0 release: they no longer have the timeMillis attribute and instead have an Instant element with epochSecond and nanoOfSecond attributes.

The Log4j 2.13.3 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.13.3 requires a minimum of Java 8 to build and run. Log4j 2.3 was the last release that supported Java 6 and Log4j 2.11.2 is the last release to support Java 7.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Fixed

  • Fix NullPointerException in ThreadContextDataInjector. (LOG4J2-2838)

2.13.2

Release date

2020-04-23

This release contains bugfixes and minor enhancements.

Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters. log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and later.

Note that the XML, JSON and YAML formats changed in the 2.11.0 release: they no longer have the timeMillis attribute and instead have an Instant element with epochSecond and nanoOfSecond attributes.

The Log4j 2.13.2 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.13.2 requires a minimum of Java 8 to build and run. Log4j 2.3 was the last release that supported Java 6 and Log4j 2.11.2 is the last release to support Java 7.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Provide a Log4j implementation of System.Logger. (LOG4J2-1360)

  • Added EventLookup to retrieve fields from the log event. (LOG4J2-2807)

Changed

  • Allow the file extension in the file pattern to be modified during reconfiguration. (LOG4J2-2457)

  • Allow servlet context path to be retrieved without "/". (LOG4J2-2520)

  • Add ContextDataProviders as an alternative to having to implement a ContextDataInjector. (LOG4J2-2779)

  • [JDBC] Throw a AppenderLoggingException instead of an NPE in the JDBC database manager. (LOG4J2-2812)

  • Allow Spring Boot applications to use composite configurations. (LOG4J2-2815)

  • Allow Spring Lookup to return default and active profiles. (LOG4J2-2818)

  • Add support for specifying an SSL configuration for SmtpAppender. (LOG4J2-2819)

Fixed

  • Add option to restore printing timeMillis in the JsonLayout. (LOG4J2-2588)

  • Fix Exceptions when whitespace is in the file path and Java security manager is used. (LOG4J2-2761)

  • Initialize pattern processor before triggering policy during reconfiguration. (LOG4J2-2766)

  • Conditionally allocate PluginEntry during PluginCache loading. (LOG4J2-2790)

  • Correct JsonLayout timestamp sorting issue. (LOG4J2-2791)

  • Allow trailing and leading spaces in log level. (LOG4J2-2793)

  • Make YamlLayoutTest more resilient to environmental differences. (LOG4J2-2794)

  • TimeFilter did not handle daylight saving time transitions and did not support a range over 2 days. (LOG4J2-2805)

  • Avoid NullPointerException when StackWalker returns null. (LOG4J2-2809)

  • Add information about using a url in log4j.configurationFile. (LOG4J2-2810)

  • Add missing includeLocation parameter when creating AsyncLogger. (LOG4J2-2811)

  • serializeToBytes was checking wrong variable for null. (LOG4J2-2813)

  • Fix Javadoc for ScriptPatternSelector. (LOG4J2-2814)

  • Allow the file size action to parse the value without being sensitive to the current locale. (LOG4J2-2817)

  • Implement requiresLocation in GelfLayout to reflect whether location information is used in the message Pattern. (LOG4J2-2824)

2.13.1

Release date

2020-02-25

This release contains bugfixes and minor enhancements.

Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters. log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and later.

Note that the XML, JSON and YAML formats changed in the 2.11.0 release: they no longer have the timeMillis attribute and instead have an Instant element with epochSecond and nanoOfSecond attributes.

The Log4j 2.13.1 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.13.1 requires a minimum of Java 8 to build and run. Log4j 2.3 was the last release that supported Java 6 and Log4j 2.11.2 is the last release to support Java 7.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Implement ISO8601_PERIOD_MICROS fixed date format matching ISO8601_PERIOD with support for microsecond precision. (LOG4J2-2748)

Changed

  • Update log4j-slf4j18-impl slf4j version to 1.8.0-beta4 from 1.8.0-alpha2. (LOG4J2-2745)

  • Update dependencies. (LOG4J2-2763)

  • Add a retry count attribute to the KafkaAppender. (LOG4J2-2777)

  • Use LinkedBlockingQueue instead of synchronized collection in StatusConfiguration. (LOG4J2-2782)

  • Conditionally perform status logging calculations in PluginRegistry. (LOG4J2-2789)

Fixed

  • Rollover fails when file matches pattern but index is too large. (LOG4J2-2039)

  • Allow Lookup keys with leading dashes by using a slash as an escape character. (LOG4J2-2211)

  • Fix lock contention in the classloader using new versions of slf4j without EventData on slf4j logger creation. (LOG4J2-2415)

  • CronExpression.getBeforeTime() would sometimes return incorrect result. (LOG4J2-2575)

  • GraalVM does not allow use of MethodHandles. (LOG4J2-2649)

  • JSON output wrong when using additional fields. (LOG4J2-2652)

  • PluginProcessor should use Messager instead of System.out. (LOG4J2-2676)

  • Rollover handles parallel file deletion gracefully. (LOG4J2-2677)

  • MapMessage.getFormattedMessage() would incorrectly format objects. (LOG4J2-2703)

  • Slow initialization on Windows due to accessing network interfaces. (LOG4J2-2717)

  • PluginCache output is reproducible allowing the annotation processor to produce deterministic results. (LOG4J2-2735)

  • Fix erroneous log4j-jul recursive logger detection resulting in some no-op JUL loggers and 'WARN Recursive call to getLogger' being reported by the status logger. (LOG4J2-2739)

  • Remove unnecessary EventLogger references from log4j-slf4j18-impl due to removal from slf4j. (LOG4J2-2744)

  • ClassLoaderContextSelector was not locating the LoggerContext during shutdown. (LOG4J2-2746)

  • Fix a memory leak using fully asynchronous logging when the queue is full using the 'discard' asynchronous queue full strategy. (LOG4J2-2747)

  • Fix StackLocator.getCallerClass performance in cases where Reflection.getCallerClass is not accessible. (LOG4J2-2751)

  • MutableLogEvent and RingBufferLogEvent avoid StringBuffer and parameter array allocation unless reusable messages are used. (LOG4J2-2752)

  • LoaderUtil.getClassLoaders may discover additional loaders and no longer erroneously returns a result with a null element in some environments. (LOG4J2-2754)

  • Prevent LoggerContext from being garbage collected while being created. (LOG4J2-2756)

  • NullPointerException when using a custom DirectFileRolloverStrategy without a file name. (LOG4J2-2758)

  • RollingFileAppender was not rolling on startup if createOnDemand was set to true. (LOG4J2-2759)

  • Always write header on a new OutputStream. (LOG4J2-2760)

  • [JDBC] MS-SQL Server JDBC driver throws SQLServerException when inserting a null value for a VARBINARY column. (LOG4J2-2762)

  • Warn if pattern is missing on Routes element. Use default route. (LOG4J2-2767)

  • Add multi-parameter overloads to LogBuilder. (LOG4J2-2768)

  • Do not log an error if Files.move does not work. (LOG4J2-2769)

  • Fixed NullPointerException after reconfiguring via JMX. (LOG4J2-2770)

  • NullPointerException after reconfiguring via JMX. (LOG4J2-2770)

  • An error message in RollingFileAppender uses a placeholder for the name but does not specify the name argument in the logging call (LOG4J2-2776)

  • ServletContainerInitializer was obtaining the StatusLogger too soon. (LOG4J2-2781)

  • Counter stuck at 10 and overwriting files when leading zeros used in the file pattern count. (LOG4J2-2784)

2.13.0

Release date

2019-12-11

This release contains bugfixes and minor enhancements. Some of the new features in this release are:

  • Log4j 2 now requires Java 8 or higher to build and run.

  • Experimental support for Log4j 1 configuration files. See Log4j 2 Compatiblity with Log4j 1.

  • The Logger API has been enhanced to support a builder pattern. This can dramatically improve the overhead of capturing location information. See Log Builder.

  • Better integration with Spring Boot by providing access to Spring variables in Log4j 2 configuration files and allowing Log4j 2 system properties to be defined in the Spring configuration. See Logging in the Cloud.

  • Support for accessing Kubernetes information via a Log4j 2 Lookup.

  • The Gelf Layout now allows the message to be formatted using a PatternLayout pattern. Logging in the Cloud provides an example of this, as well as the use of the Spring and Kubernetes Lookups.

Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters. log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and later.

Note that the XML, JSON and YAML formats changed in the 2.11.0 release: they no longer have the timeMillis attribute and instead have an Instant element with epochSecond and nanoOfSecond attributes.

The Log4j 2.13.0 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.13.0 requires a minimum of Java 8 to build and run. Log4j 2.3 was the last release that supported Java 6 and Log4j 2.11.2 is the last release to support Java 7.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Add builder pattern to Logger interface. (LOG4J2-2639)

  • Allow Spring Boot application properties to be accessed in the Log4j 2 configuration. Add lower and upper case Lookups. (LOG4J2-2710)

  • Add the ability to lookup Kubernetes attributes in the Log4j configuration. Allow Log4j properties to be retrieved from the Spring environment if it is available. (LOG4J2-2716)

  • Add a Level Pattern Selector. (LOG4J2-2731)

  • Add ThreadContext.putIfNotNull method. (LOG4J2-2732)

  • Add experimental support for Log4j 1 configuration files. (LOG4J2-63)

Changed

  • Update Jackson to 2.9.10. (LOG4J2-2701)

  • Allow message portion of GELF layout to be formatted using a PatternLayout. Allow ThreadContext attributes to be explicitly included or excluded in the GelfLayout. (LOG4J2-2709)

Fixed

  • Prevent recursive calls to java.util.LogManager.getLogger(). (LOG4J2-2058)

  • Wrong java version check in ThreadNameCachingStrategy. (LOG4J2-2635)

  • Validation blocks definition of script in properties configuration. (LOG4J2-2647)

  • Add automatic module names where missing. (LOG4J2-2672)

  • OutputStreamAppender.Builder ignores setFilter(). (LOG4J2-2673)

  • Use a less confusing name for the CompositeConfiguration source. (LOG4J2-2674)

  • Set result of rename action to true if file was copied. (LOG4J2-2680)

  • @PluginValue does not support attribute names besides "value". (LOG4J2-2693)

  • ArrayIndexOutOfBoundsException could occur with MAC address longer than 6 bytes. (LOG4J2-2707)

  • The rolling file appenders would fail to compress the file after rollover if the file name matched the file pattern. (LOG4J2-2712)

  • LOG4J2-2725 - Added try/finally around event.execute() for RingBufferLogEventHandler to clear memory correctly in case of exception/error (LOG4J2-2725)

  • Prevent a memory leak when async loggers throw errors. (LOG4J2-2725)

  • Add setKey method to Kafka Appender Builder. (LOG4J2-2727)

2.12.1

Release date

2019-08-06

This release contains bugfixes and minor enhancements.

This release improves the performance of capturing location information, makes log4j-core optional in the log4j 1.2 bridge, and explicitly removes LoggerContext references from components that keep track of them when the LoggerContext is shut down. More details on the new features and fixes are itemized below.

Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters. log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and later.

Note that the XML, JSON and YAML formats changed in the 2.11.0 release: they no longer have the timeMillis attribute and instead have an Instant element with epochSecond and nanoOfSecond attributes.

The Log4j 2.12.1 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.12.1 requires a minimum of Java 8 to build and run. Log4j 2.3 was the last release that supported Java 6 and Log4j 2.11.2 is the last release to support Java 7.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Changed

  • Make Log4j Core optional for Log4j 1.2 API. (LOG4J2-2556)

  • Update MongoDB 3 driver from 3.10.1 to 3.10.2. (LOG4J2-2646)

  • Improve exception messages in the JDBC appender. (LOG4J2-2657)

  • Retry when JDBC throws a java.sql.SQLTransactionRollbackException in commitAndClose(). (LOG4J2-2660)

Fixed

  • Allow file renames to work when files are missing from the sequence. (LOG4J2-1946)

  • Remove references to LoggerContext when it is shutdown. (LOG4J2-2366)

  • Improve the performance of capturing location information. (LOG4J2-2644)

  • Support emulating a MAC address when using ipv6. (LOG4J2-2650)

  • AbstractAction.reportException records a warning to the status logger, providing more information when file based appenders fail to compress rolled data asynchronously. (LOG4J2-2658)

  • AbstractAction handles and records unchecked RuntimeException and Error in addition to IOException. (LOG4J2-2659)

  • "Values not bound to statement" when using JDBC appender, appender does not respect bufferSize="0". (LOG4J2-2667)

2.12.0

Release date

2019-06-23

This release contains bugfixes and minor enhancements.

Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters. log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and later.

New features include support for reconfiguration of Log4j configuraton files accessed via HTTP(s) and Spring Cloud Config specifically, a new Docker Lookup for obtaining information about the current Docker container, new reconfiguration methods added to the Configurator class, the ability to pad integers with leading zeros in filenames generated by the rolling file appenders, and allowing the TCP SocketAppender to connect to multiple IP addresses when they are returned from DNS.

More details on the new features and fixes are itemized below.

Note that the XML, JSON and YAML formats changed in the 2.11.0 release: they no longer have the timeMillis attribute and instead have an Instant element with epochSecond and nanoOfSecond attributes.

The Log4j 2.12.0 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.12.0 requires a minimum of Java 7 to build and run. Log4j 2.3 was the last release that supported Java 6.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Allow custom end-of-line with JsonLayout. (LOG4J2-2337)

  • Allow zero padding the counter of a RollingFileAppender. (LOG4J2-2403)

  • Add reconfiguration methods to Configurator. (LOG4J2-2406)

  • Add filter that will match events when no marker is present. (LOG4J2-2427)

  • TCP Appender should support a host name resolving to multiple IP addresses. (LOG4J2-2586)

  • GZIP compression on rollover supports configurable compression levels. (LOG4J2-2598)

  • AsyncQueueFullPolicy configuration short values "Default" and "Discard" are case-insensitive to avoid confusion. (LOG4J2-2611)

  • Add and use method org.apache.logging.log4j.message.MapMessage.toKey(String) for simpler subclasses. (LOG4J2-2634)

  • Add support for reconfiguration via HTTP(S), Docker, and Spring Cloud Configuration. (LOG4J2-913)

Changed

  • Update Jackson from 2.9.7 to 2.9.8. (LOG4J2-2570)

  • Update MongoDB 3 module driver from 3.9.0 to 3.10.1. (LOG4J2-2574)

  • Update Jackson from 2.9.8 to 2.9.9. (LOG4J2-2619)

  • Refactor several AsyncLogger methods below the 35 byte threshold for inlining. (LOG4J2-2634)

  • Update tests from H2 1.4.197 to 1.4.199.

Fixed

  • FailoverAppender was failing with ERROR appender Failover has no parameter that matches element Failovers. (LOG4J2-1103)

  • Lookups were not found if the plugin key was not lower case. (LOG4J2-1143)

  • Locate plugins within a Jar using a URL Connection. (LOG4J2-1852)

  • RollingRandomAccessFileAppender error message referenced incorrect class name. (LOG4J2-2547)

  • NullPointerException in JdbcAppender.createAppender(). (LOG4J2-2559)

  • JEP223 version detection fix for JDK 9 and up. (LOG4J2-2561)

  • MapPatternConverter is properly created from the '%K', '%map', and '%MAP' patterns. PatternConverter instanceOf methods with unknown parameter types no longer elide those with known parameters. (LOG4J2-2564)

  • StackOverflowException when server not reachable with SocketAppender. (LOG4J2-2592)

  • Throw better exception message when both log4j-slf4j-impl and log4j-to-slf4j are present. (LOG4J2-2597)

  • java.lang.StackOverflowError at org.apache.logging.log4j.junit.AbstractExternalFileCleaner.println(AbstractExternalFileCleaner.java:169). (LOG4J2-2598)

  • Update file time when size based triggering policy is used without a time-based triggering policy. (LOG4J2-2602)

  • Asynchronous logging when the queue is full no longer results in heavy CPU utilization and low throughput. (LOG4J2-2606)

  • Explicitly set file creation time. (LOG4J2-2610)

  • NullPointerException at org.apache.logging.log4j.core.appender.db.jdbc.JdbcDatabaseManager.writeInternal(JdbcDatabaseManager.java:803). (LOG4J2-2612)

  • Restore constructor to ThrowablePatternConverter that was removed in 2.8.2. (LOG4J2-2616)

  • Possible ClassCastException in org.apache.logging.log4j.core.script.ScriptManager.ScriptManager(Configuration, WatchManager) (LOG4J2-2618)

  • StructuredDataId was ignoring maxLength attribute. (LOG4J2-2622)

  • Fix a race allowing events not to be recorded when a RoutingAppender purge policy attempts to delete an idle appender at exactly the same time as a new event is recorded. (LOG4J2-2629)

  • RoutingAppender PurgePolicy implementations no longer stop appenders referenced from the logger configuration, only those that have been created by the RoutingAppender. Note that RoutingAppender.getAppenders no longer includes entries for referenced appenders, only those which it has created. (LOG4J2-2631)

  • RFC5424Layout was not properly setting default Structured Element id for the MDC (LOG4J2-2636)

2.11.2

Release date

2019-02-04

This release contains bugfixes and minor enhancements.

Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters. log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and later.

As of Log4j 2.9.0, the Log4j API was modified to use java.util.ServiceLoader to locate Log4j implementations, although the former binding mechanism is still supported. The Log4j API JAR is now a multi-release JAR to provide implementations of Java 9 specific classes. Multi-release JARs are not supported by the OSGi specification so OSGi modules will not be able to take advantage of these implementations but will not lose functionality as they will fall back to the implementations used in Java 7 and 8. Applications using Spring Boot must add the Multi-Release header to the JAR manifest or the Java 9+ classes will be ignored.

More details on the new features and fixes are itemized below. Note that some tools are not compatible with multi-release JARs and may fail trying to process class files in the META-INF/versions/9 folder. Those errors should be reported to the tool vendor.

Note that subsequent to the 2.9.0 release, for security reasons, Log4j does not process DTD in XML files. If you used DTD for including snippets, you have to use XInclude or Composite Configuration instead.

Also subsequent to the 2.9.0 release, for security reasons, SerializedLayout is deprecated and no longer used as default in the Socket and JMS appenders. SerializedLayout can still be used as before, but has to be specified explicitly. To retain old behaviour, you have to change configuration like:

<Appenders>
  <Socket name="socket" host="localhost" port="9500"/>
</Appenders>

into:

<Appenders>
  <Socket name="socket" host="localhost" port="9500">
    <SerializedLayout/>
  </Socket>
</Appenders>

We do, however, discourage the use of SerializedLayout and recommend JsonLayout as a replacement:

<Appenders>
  <Socket name="socket" host="localhost" port="9500">
    <JsonLayout properties="true"/>
  </Socket>
</Appenders>

Note that the XML, JSON and YAML formats changed in the 2.11.0 release: they no longer have the timeMillis attribute and instead have an Instant element with epochSecond and nanoOfSecond attributes.

The Log4j 2.11.2 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.11.2 requires a minimum of Java 7 to build and run. Log4j 2.3 was the last release that supported Java 6.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • PatternLayout %date conversion pattern should render time zone designator for ISO-ISO8601. (LOG4J2-1246)

  • JDBC Appender should reconnect to the database when a connection goes stale. (LOG4J2-2496)

  • Let JDBC PoolingDriverConnectionSource with Apache Commons DBCP configure a PoolableConnectionFactory. (LOG4J2-2505)

  • Allow a JDBC Appender to truncate strings to match a table’s metadata column length limit. (LOG4J2-2509)

Changed

  • Switch from CLIRR to RevAPI for detecting API changes. (LOG4J2-1576)

  • Improve exception logging performance. ThrowableProxy construction uses a faster method to discover the current stack trace. ThrowablePatternConverter and ExtendedThrowablePatternConverter default configurations no longer allocate an additional buffer for stack trace contents. (LOG4J2-2391)

  • Better handling of %highlight pattern when using jul-bridge. (LOG4J2-2405)

  • Let the NullAppender default its name to "null". (LOG4J2-2447)

  • Update Jackson from 2.9.6 to 2.9.7. (LOG4J2-2468)

  • Update Apache Commons Compress from 1.17 to 1.18. (LOG4J2-2469)

  • Update Apache Commons CSV from 1.5 to 1.6. (LOG4J2-2470)

  • Update javax.mail from 1.6.1 to 1.6.2. (LOG4J2-2471)

  • Update mongo-java-driver 3 from 3.8.0 to 3.8.2. (LOG4J2-2472)

  • JDBC Appender should release parameter resources ASAP. (LOG4J2-2489)

  • Allow all Appenders to optionally carry a Property array. (LOG4J2-2491)

  • Update MongoDB driver from 3.8.2 to 3.9.0 for log4j-mongodb3 module. (LOG4J2-2503)

Fixed

  • Logging with a lambda expression with a method call that also logs would cause logs within method call to reference line num and method name of the parent method. (LOG4J2-1570)

  • Fixed Appenders section in Extending Log4j. (LOG4J2-1571)

  • Direct write was creating files with the wrong date/time. (LOG4J2-1906)

  • Expose LoggerContext.setConfiguration as a public method. (LOG4J2-2009)

  • Use the file pattern as the FileManager "name" when no filename is present. (LOG4J2-2061)

  • StackOverflowError at AwaitCompletionReliabilityStrategy. (LOG4J2-2134)

  • Fix memory leak in ReusableParameterizedMessage. (LOG4J2-2201)

  • Load PropertySources from any accessible ClassLoader. Hide any exceptions that may occur accessing a PropertySource. (LOG4J2-2266)

  • ReusableObjectMessage parameter is properly passed to appenders (#203). (LOG4J2-2363)

  • NameAbbreviator correctly abbreviates first fragments (#188). (LOG4J2-2365)

  • Pre-deployment of PersistenceUnit that using Log4j as session logger failed (#198). (LOG4J2-2397)

  • Exceptions are added to all columns when a JDBC Appender’s ColumnMapping uses a Pattern. (LOG4J2-2413)

  • NullPointerException when closing never used RollingRandomAccessFileAppender. (LOG4J2-2418)

  • Handle some unchecked exceptions while loading plugins. (LOG4J2-2422)

  • Setting a null ErrorHandler on AbstractAppender is not allowed and will no-op as expected. (LOG4J2-2441)

  • ErrorHandler is invoked with a LogEvent and Throwable when possible, where previously only a string was used. (LOG4J2-2444)

  • Add Log4j-slf4j18-impl dependency to BOM POM. (LOG4J2-2453)

  • RollingRandomAccessFileManager ignores new file patterns from programmatic reconfiguration. (LOG4J2-2457)

  • ColumnMapping literal not working. (LOG4J2-2466)

  • org.apache.log4j.SimpleLayout and ConsoleAppender missing in log4j-1.2-api. (LOG4J2-2476)

  • AbstractStringLayoutStringEncodingBenchmark returns the computed variables on each benchmark to avoid DCE. (LOG4J2-2478)

  • Avoid NullPointerExceptions in org.apache.logging.log4j.core.config.AbstractConfiguration for null arguments. (LOG4J2-2481)

  • BasicContextSelector cannot be used in a OSGI application. (LOG4J2-2482)

  • SizeBasedTriggeringPolicy was not honored when using the DirectWriteRolloverStrategy if the machine restarts. (LOG4J2-2485)

  • JmsAppender reconnectIntervalMillis cannot be set from a configuration file. (LOG4J2-2497)

  • JMS Appender may throw a NullPointerException when JMS is not up while the Appender is starting. (LOG4J2-2499)

  • Document that Properties element must be the first configuration element. (LOG4J2-2500)

  • JDBC Appender fails when using both parameter, source, and literal ColumnMapping elements. (LOG4J2-2508)

  • Make Strings.toRootUpperCase a static method so it can be accessed. (LOG4J2-2514)

  • Configuration documentation referenced incorrect method name. (LOG4J2-2515)

  • Fix regression using MapMessageLookup.lookup with MapMessages that do not implement StringMapMessage. (LOG4J2-2522)

  • Prevent ConcurrentModificationException while iterating over ListAppender events. (LOG4J2-2527)

  • Generalize checks using MapMessage implementations with do not extend StringMapMessage. Introduce new JAVA_UNQUOTED MapMessage format type based on the JAVA formatting, but without quoted values. (LOG4J2-2530)

  • Fix a regression introduced by LOG4J2-2301 in 2.11.1 allowing allocation to occur in AsyncLoggerConfig. (LOG4J2-2533)

  • CronTriggeringPolicy was not rolling properly, especially when used with the SizeBasedTriggeringPolicy. (LOG4J2-2542)

  • Add Log4j-to-SLF4J to BOM pom.xml. (LOG4J2-2543)

2.11.1

Release date

2018-07-22

This release contains new features, bugfixes and minor enhancements.

Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters. log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and later.

As of Log4j 2.9.0, the Log4j API was modified to use java.util.ServiceLoader to locate Log4j implementations, although the former binding mechanism is still supported. The Log4j API JAR is now a multi-release JAR to provide implementations of Java 9 specific classes. Multi-release JARs are not supported by the OSGi specification so OSGi modules will not be able to take advantage of these implementations but will not lose functionality as they will fall back to the implementations used in Java 7 and 8. More details on the new features and fixes are itemized below. Note that some tools are not compatible with multi-release JARs and may fail trying to process class files in the META-INF/versions/9 folder. Those errors should be reported to the tool vendor.

Note that subsequent to the 2.9.0 release, for security reasons, SerializedLayout is deprecated and no longer used as default in the Socket and JMS appenders. SerializedLayout can still be used as before, but has to be specified explicitly. To retain old behaviour, you have to change configuration like:

<Appenders>
  <Socket name="socket" host="localhost" port="9500"/>
</Appenders>

into:

<Appenders>
  <Socket name="socket" host="localhost" port="9500">
    <SerializedLayout/>
  </Socket>
</Appenders>

We do, however, discourage the use of SerializedLayout and recommend JsonLayout as a replacement:

<Appenders>
  <Socket name="socket" host="localhost" port="9500">
    <JsonLayout properties="true"/>
  </Socket>
</Appenders>

Note that subsequent to the 2.9.0 release, for security reasons, Log4j does not process DTD in XML files. If you used DTD for including snippets, you have to use XInclude or Composite Configuration instead.

The Log4j 2.11.1 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.11.1 requires a minimum of Java 7 to build and run. Log4j 2.3 was the last release that supported Java 6.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Changed

  • Allow composite configuration for context parameter. (LOG4J2-1721)

  • Status logger should show the Log4j name and version when initializing itself. (LOG4J2-2302)

  • Log4j2 2.8.2 JMX unregister NullPointerException. (LOG4J2-2304)

  • Update Jackson from 2.9.4 to 2.9.5. (LOG4J2-2311)

  • Update LMAX Disruptor from 3.3.7 to 3.4.2. (LOG4J2-2313)

  • Update JAnsi from 1.17 to 1.17.1. (LOG4J2-2328)

  • Added AbstractLogEvent.getMutableInstant to allow the MutableInstant instance to be modified by classes extending AbstractLogEvent. (LOG4J2-2351)

  • Update Jackson from 2.9.5 to 2.9.6. (LOG4J2-2357)

  • Update Kafka client from 1.0.0 to 1.1.0. (LOG4J2-2358)

  • Update Kafka client from 1.1.0 to 1.1.1. (LOG4J2-2384)

  • Update Groovy from 2.4.13 to 2.5.1. (LOG4J2-2385)

  • Update optional Apache Commons DBCP from 2.2.0 to 2.4.0. (LOG4J2-2386)

  • Log4j 2.0 ERROR "Could not search jar" with JBoss EAP 6.2. (LOG4J2-548)

Fixed

  • Curly braces in parameters are not treated as placeholders. (LOG4J2-2032)

  • Improve plugin error message when elements are missing. (LOG4J2-2268)

  • MutableLogEvent references to other objects are cleared after each use. Fix a memory leak causing references to parameters to be held after synchronous logging with thread locals enabled. (LOG4J2-2269)

  • ParserConfigurationException when using Log4j with oracle.xml.jaxp.JXDocumentBuilderFactory. (LOG4J2-2283)

  • PoolingDriverConnectionSource does not take into account properties, user name, and password. (LOG4J2-2300)

  • Mixed async loggers no longer forget parameter values, providing some appenders with an array of nulls. (LOG4J2-2301)

  • Make java.util.ServiceLoader properly work in OSGi by using the Service Loader Mediator Specification. (LOG4J2-2305)

  • Split the SLF4J binding into 2 implementations - one for SLF4J 1.7.x and one for SLF4J 1.8+. (LOG4J2-2305)

  • MutableLogEvent and RingBufferLogEvent message mementos retain the original format string. (LOG4J2-2307)

  • Jackson layouts used with AsyncLoggerContextSelector output the expected format rather than only a JSON string of the message text. (LOG4J2-2312)

  • If root LoggerConfig does not have a Level return ERROR. (LOG4J2-2316)

  • MutableLogEvent.getNonNullImmutableMessage and Log4jLogEvent.makeMessageImmutable retain format and parameters. (LOG4J2-2317)

  • Messages are no longer mutated when the asynchronous queue is full. A warning is logged to the status logger instead. (LOG4J2-2318)

  • Fix NPE in AbstractLogger when another exception is thrown, masking the root cause. (LOG4J2-2320)

  • AsyncLogger uses the correct level when unspecified. This provides parity between AsyncLogger and Logger. (LOG4J2-2321)

  • Custom ContextSelector implementations which select an AsyncLoggerContext disable LoggerConfig.includeLocation by default for parity with AsyncLoggerContextSelector. (LOG4J2-2322)

  • RollingFileManager debug logging avoids string concatenation and errant braces in favor of parameterized logging. (LOG4J2-2331)

  • Handle errors thrown in default disruptor ExceptionHandler implementations to avoid killing background threads. (LOG4J2-2333)

  • Add API org.apache.logging.log4j.core.appender.AsyncAppender.getQueueSize(). (LOG4J2-2334)

  • Remove duplicate hyphen from the AsyncLoggerConfig background thread name. (LOG4J2-2336)

  • The OSGi Activator specified an incorrect version. (LOG4J2-2343)

  • Update Apache Commons Compress from 1.16.1 to 1.17. (LOG4J2-2347)

  • RingBufferLogEvent memento messages provide the expected format string, and no longer attempt to substitute parameters into curly braces in parameter toString values. Both RingBufferLogEvent and MutableLogEvent memento implementations memoize results to avoid rebuilding formatted string values. (LOG4J2-2352)

  • PropertiesUtil ignores non-string system properties. Fixes a NoClassDefFoundError initializing StatusLogger caused by an NPE while initializing the static PropertiesUtil field. (LOG4J2-2355)

  • Fixed a memory leak in which ReusableObjectMessage would hold a reference to the most recently logged object. (LOG4J2-2362)

  • Fixed a memory leak in which ReusableParameterizedMessage would hold a reference to the most recently logged throwable and provided varargs array. (LOG4J2-2364)

  • Nested logging doesn’t clobber AbstractStringLayout cached StringBuilders (LOG4J2-2368)

  • StringBuilders.escapeJson implementation runs in linear time. Escaping large JSON strings in EncodingPatternConverter and MapMessage will perform significantly better. (LOG4J2-2373)

  • StringBuilders.escapeXml implementation runs in linear time. Escaping large XML strings in EncodingPatternConverter and MapMessage will perform significantly better. (LOG4J2-2376)

  • NullPointerException in org.apache.logging.log4j.util.LoaderUtil.getClassLoaders() when using Bootstrap class loader. (LOG4J2-2377)

  • Update Mongodb 3 driver from 3.6.3 to 3.8.0. (LOG4J2-2382)

  • Thread indefinitely blocked when logging a message in an interrupted thread. (LOG4J2-2388)

  • ThrowableProxy was saving and retrieving cache entries using different keys. (LOG4J2-2389)

  • Fix broken links in log4j web documentation. (LOG4J2-2390)

2.11.0

Release date

2018-03-11

This release contains new features, bugfixes and minor enhancements. Some of the new features include support for the Java 9 module system, support for the new SLF4j 1.8 binding mechanism, simplification of the Log4j property naming scheme, and native support of Jetty’s logger. Log4j API is now a fully compliant module while the other Log4j jars are named automatic modules.

As of Log4j 2.9.0, the Log4j API was modified to use java.util.ServiceLoader to locate Log4j implementations, although the former binding mechanism is still supported. The Log4j API JAR is now a multi-release JAR to provide implementations of Java 9 specific classes. Multi-release JARs are not supported by the OSGi specification so OSGi modules will not be able to take advantage of these implementations but will not lose functionality as they will fall back to the implementations used in Java 7 and 8. More details on the new features and fixes are itemized below. Note that some tools are not compatible with multi-release JARs and may fail trying to process class files in the META-INF/versions/9 folder. Those errors should be reported to the tool vendor.

Note that subsequent to the 2.9.0 release, for security reasons, SerializedLayout is deprecated and no longer used as default in the Socket and JMS appenders. SerializedLayout can still be used as before, but has to be specified explicitly. To retain old behaviour, you have to change configuration like:

<Appenders>
  <Socket name="socket" host="localhost" port="9500"/>
</Appenders>

into:

<Appenders>
  <Socket name="socket" host="localhost" port="9500">
    <SerializedLayout/>
  </Socket>
</Appenders>

We do, however, discourage the use of SerializedLayout and recommend JsonLayout as a replacement:

<Appenders>
  <Socket name="socket" host="localhost" port="9500">
    <JsonLayout properties="true"/>
  </Socket>
</Appenders>

Note that subsequent to the 2.9.0 release, for security reasons, Log4j does not process DTD in XML files. If you used DTD for including snippets, you have to use XInclude or Composite Configuration instead.

The Log4j 2.11.0 API, as well as many core components, maintains binary compatibility with previous releases with the following exceptions to Log4j Core. Log4j 2.11.0 moves code from log4j-core to several new Maven modules. Dependencies to other JARs that used to be optional in log4j-core are now required in the new modules. The code in these modules have been repackaged. These changes do not affect your configuration files.

The new modules are:

log4j-jdbc-dbc2
  • Group ID: `org.apache.logging.log4j

  • Artifact ID: log4j-jdbc-dbc2

  • Old package: org.apache.logging.log4j.core.appender.db.jdbc

  • New package: org.apache.logging.log4j.jdbc.appender

log4j-jpa
  • Group ID: org.apache.logging.log4j

  • Artifact ID: log4j-jpa

  • Old package 1: org.apache.logging.log4j.core.appender.db.jpa

  • New package 1: org.apache.logging.log4j.jpa.appender

  • Old package 2: org.apache.logging.log4j.core.appender.db.jpa.converter

  • New package 2: org.apache.logging.log4j.jpa.converter

log4j-mongodb2
  • Group ID: org.apache.logging.log4j

  • Artifact ID: log4j-mongodb2

  • Old package: org.apache.logging.log4j.mongodb

  • New package: org.apache.logging.log4j.mongodb2

log4j-mongodb3
  • Group ID: org.apache.logging.log4j

  • Artifact ID: log4j-mongodb3

  • Old package: org.apache.logging.log4j.mongodb

  • New package: org.apache.logging.log4j.mongodb3

Log4j 2.11.0 requires a minimum of Java 7 to build and run. Log4j 2.3 was the last release that supported Java 6.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Added support for precise (micro and nanosecond) timestamps when running on Java 9. A limited number of precise %d date formats are supported with PatternLayout. POTENTIAL BREAKING CHANGE: The XML, JSON and YAML formats have changed: they no longer have the "timeMillis" attribute and instead have an "Instant" element with "epochSecond" and "nanoOfSecond" attributes. (LOG4J2-1883)

  • Add missing converters to PatternLayout. (LOG4J2-2143)

  • Add API org.apache.logging.log4j.core.lookup.Interpolator.getStrLookupMap(). (LOG4J2-2160)

  • The MongoDB Appender should use a keys and values for a Log4j MapMessage. (LOG4J2-2179)

  • Add a MongoDbProvider builder for and deprecate org.apache.logging.log4j.mongodb.MongoDbProvider.createNoSqlProvider(). (LOG4J2-2180)

  • The JDBC Appender should use keys and values from a Log4j MapMessage. (LOG4J2-2181)

  • Add a simple JDBC DriverManager-based ConnectionSource that uses JDBC’s DriverManager#getConnection(String, String, String). (LOG4J2-2185)

  • Add a JDBC ConnectionSource that provides pooling through Apache Commons DBCP 2. (LOG4J2-2186)

  • Add a hook for a Connection Source for a JDBC Appender to release its resources. (LOG4J2-2187)

  • Output JSON object for ObjectMessage in JsonLayout. (LOG4J2-2190)

  • Made log4j-core a multi-release ("multi-version") jar, added log4j-core-java9 module. (LOG4J2-2191)

  • Add org.apache.logging.log4j.core.util.WatchManager#unwatch(File). (LOG4J2-2203)

  • Add method org.apache.logging.log4j.core.util.WatchManager.reset(File) and reset(). (LOG4J2-2206)

  • Add debug logging to org.apache.logging.log4j.mongodb.MongoDbConnection. (LOG4J2-2208)

  • Add API to enable iterating over message parameters without creating temporary objects. (LOG4J2-2253)

Changed

  • Removed unnecessary threadlocal StringBuilder field from MdcPatternConverter. (LOG4J2-2127)

  • Update ZeroMQ’s jeromq from 0.4.2 to 0.4.3. (LOG4J2-2132)

  • Update version of maven bundle plugin to 3.4.0. Convert bundle plugin error to a warning. (LOG4J2-2146)

  • Update Jackson from 2.9.2 to 2.9.3. (LOG4J2-2165)

  • NullPointerException at org.apache.logging.log4j.util.Activator.loadProvider(Activator.java:81) in log4j 2.10.0. (LOG4J2-2182)

  • Update MongoDB driver from 3.0.4 to 3.6.1. (LOG4J2-2184)

  • Split off JPA support into a new module log4j-jpa. (LOG4J2-2188)

  • Update JMH to version 1.19 from 1.1.1. (LOG4J2-2193)

  • Require Java 9 to compile the log4j-perf module to allow benchmarking with Java 9 APIs. (LOG4J2-2194)

  • Document default property value support. (LOG4J2-2197)

  • Update MongoDB dependencies from classic to modern. (LOG4J2-2198)

  • MarkerFilter onMismatch invalid attribute in .properties. (LOG4J2-2202)

  • org.apache.logging.log4j.core.util.WatchManager.getWatchers() should pre-allocate its new Map. (LOG4J2-2204)

  • New module log4j-mongodb3: Remove use of deprecated MongoDB APIs and code to the Java driver version 3 API. (LOG4J2-2205)

  • Rename existing MongoDb plugin and related artifacts from MongoDb to MongoDb2. (LOG4J2-2209)

  • Fix error log message for Script which says ScriptFile instead. (LOG4J2-2210)

  • Unnecessary contention in CopyOnWriteSortedArrayThreadContextMap. (LOG4J2-2212)

  • Unnecessary contention in GarbageFreeSortedArrayThreadContextMap. (LOG4J2-2213)

  • Unnecessary contention in DefaultThreadContextMap. (LOG4J2-2214)

  • Reduce compiler warnings in log4j-api. (LOG4J2-2215)

  • Configuration builder classes should look for "onMismatch", not "onMisMatch". (LOG4J2-2219)

  • Update Jackson from 2.9.3 to 2.9.4. (LOG4J2-2229)

  • Removed unnecessary dependency on jcommander since Log4j uses embedded picocli since 2.9. (LOG4J2-2236)

  • Cannot see or copy all of certain JAnsi exception messages on Windows due to NUL characters. (LOG4J2-2243)

  • Update Apache Commons Compress from 1.15 to 1.16.1. (LOG4J2-2245)

  • The internal status logger timestamp format is now configurable with system property log4j2.StatusLogger.DateFormat. (LOG4J2-2250)

  • Reusable LogEvents now pass the original format string to downstream components like layouts and filters. (LOG4J2-2252)

  • Update MongoDB 3 module from driver 3.6.1 to 3.6.3. (LOG4J2-2259)

  • [SMTP] Update javax.mail from 1.6.0 to 1.6.1. (LOG4J2-2260)

  • Update JAnsi from 1.16 to 1.17. (LOG4J2-2264)

  • Documentation fix in manual page for custom configurations. (LOG4J2-2273)

Fixed

  • Revert OSGi API version to 4.3.1. (LOG4J2-1976)

  • Avoid null attribute values in DefaultConfigurationBuilder. (LOG4J2-2002)

  • LoaderUtil was not looping properly over class loaders. (LOG4J2-2104)

  • DefaultMergeStrategy did not merge filters on loggers correctly. (LOG4J2-2123)

  • Removed compile-time dependency on Java Management APIs from Log4J API module to improve compatibility with Android Platform which does not support JMX extensions. (LOG4J2-2126)

  • Log4j2 throws NoClassDefFoundError in Java 9 in java.util.ServiceLoader. (LOG4J2-2129)

  • Don’t create exit message in traceExit® when logging is disabled. (LOG4J2-2157)

  • Fixed bug where ThreadContext map was cleared, resulting in entries being only available for one log event. (LOG4J2-2158)

  • Allow SortedArrayStringMap to be filtered upon deserialization. Fix build error in Java 9 when compiling log4j-core test classes. (LOG4J2-2163)

  • Fix typo in Property Substitution docs. (LOG4J2-2175)

  • NullPointerException would occur when header was provided to a Layout on RollingRandingAccessFileAppender with DirectWriteRolloverStrategy. (LOG4J2-2247)

  • Incorrect automatics module name header was being included in manifests. (LOG4J2-2254)

  • Strings::join, when called with [null] returns "null" instead of EMPTY. (LOG4J2-2270)

  • Move module-info.class to META-INF/versions/9 directory. (LOG4J2-2271)

  • Allow EnvironmentPropertySource to run with a SecurityManager that rejects environment variable access. (LOG4J2-2274)

  • ConcurrentModificationException from org.apache.logging.log4j.status.StatusLogger.<clinit>(StatusLogger.java:71). (LOG4J2-2276)

  • Allow SystemPropertiesPropertySource to run with a SecurityManager that rejects system property access. (LOG4J2-2279)

2.10.0

Release date

2017-11-18

This release contains new features, bugfixes and minor enhancements. Some of the new features include support for the Java 9 module system, support for the new SLF4j 1.8 binding mechanism, simplification of the Log4j property naming scheme, and native support of Jetty’s logger. Log4j API is now a fully compliant Java 9 module while the other Log4j jars are Java 9 named automatic modules.

This release supports both SLF4J 1.7.x and SLF4J 1.8.x. Because SLF4J 1.7.x requires implementations to include classes in the org.slf4j.impl package log4j-sl4j-impl cannot be used as a Java 9 module. Support for SLF4J 1.7.x will be removed in a future release.

As of Log4j 2.9.0, the Log4j API was modified to use java.util.ServiceLoader to locate Log4j implementations, although the former binding mechanism is still supported. The Log4j API JAR is now a multi-release JAR to provide implementations of Java 9 specific classes. Multi-release JARs are not supported by the OSGi specification so OSGi modules will not be able to take advantage of these implementations but will not lose functionality as they will fall back to the implementations used in Java 7 and 8. More details on the new features and fixes are itemized below. Note that some tools are not compatible with multi-release JARs and may fail trying to process class files in the META-INF/versions/9 folder. Those errors should be reported to the tool vendor.

During testing of the release it was found that one unit test fails when run on Windows. When building from source either use mvn clean install -DskipTests on Windows or run the build on a different operating system. The unit test failure is a problem in the test, not in Log4j. As always, pre-built distributions can be downloaded from http://www.apache.org/dist/logging/log4j/ or the binaries JARs may be obtained from the Maven central repository.

Note that subsequent to the 2.9.0 release, for security reasons, SerializedLayout is deprecated and no longer used as default in the Socket and JMS appenders. SerializedLayout can still be used as before, but has to be specified explicitly. To retain old behaviour, you have to change configuration like:

<Appenders>
  <Socket name="socket" host="localhost" port="9500"/>
</Appenders>

into:

<Appenders>
  <Socket name="socket" host="localhost" port="9500">
    <SerializedLayout/>
  </Socket>
</Appenders>

We do, however, discourage the use of SerializedLayout and recommend JsonLayout as a replacement:

<Appenders>
  <Socket name="socket" host="localhost" port="9500">
    <JsonLayout properties="true"/>
  </Socket>
</Appenders>

Note that subsequent to the 2.9.0 release, for security reasons, Log4j does not process DTD in XML files. If you used DTD for including snippets, you have to use XInclude or Composite Configuration instead.

The Log4j 2.10.0 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.10.0 requires a minimum of Java 7 to build and run. Log4j 2.3 was the last release that supported Java 6.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Allow filtering of line breaks in layout pattern. (LOG4J2-1203)

  • Simplify log4j system property naming scheme. (LOG4J2-1431)

  • Add fields with fixed values to JSON/XML/YAML layouts. (LOG4J2-1694)

  • Add global configuration environment SPI. (LOG4J2-1809)

  • Provide ways to configure SSL that avoid plain-text passwords in the log4j configuration. The configuration may now specify a system environment variable that holds the password, or the path to a file that holds the password. (LOG4J2-2054)

  • Modularize Log4j-api and make most other log4j jars automatic modules. (LOG4J2-2056)

  • Add possibility of sending the key of a message to Kafka using KafkaAppender. (LOG4J2-2062)

  • Add org.apache.logging.log4j.core.config.composite.CompositeConfiguration#toString(). (LOG4J2-2071)

  • Add a noop AppenderSkeleton for applications still using Log4j 1.x. (LOG4J2-2098)

  • XML encoding for PatternLayout. (LOG4J2-2103)

  • Add property to disable message pattern converter lookups. (LOG4J2-2109)

  • MapMessage should use deep toString for values. (LOG4J2-2112)

  • Provide a native Log4j 2 implementation of Eclipse Jetty’s org.eclipse.jetty.util.log.Logger. (LOG4J2-2114)

  • Properly escape newlines and other control characters in JSON. (LOG4J2-2120)

Changed

  • Update classes in org.apache.logging.log4j.core.net.ssl in APIs from String to a PasswordProvider producing char[] for passwords. (LOG4J2-1896)

  • Provide support for overriding the Tomcat Log class in Tomcat 8.5+. (LOG4J2-2025)

  • Disable thread name caching by default when running on Java 8u102 or later. (LOG4J2-2052)

  • Support new SLF4J binding mechanism introduced in SLF4J 1.8. (LOG4J2-2057)

  • Split up log4j-nosql into one module per appender. (LOG4J2-2076)

  • Update from Jackson 2.9.1 to 2.9.2. (LOG4J2-2077)

  • Update LMAX disruptor from 3.3.6 to 3.3.7. (LOG4J2-2078)

  • Update Apache Commons Compress from 1.14 to 1.15. (LOG4J2-2081)

  • Upgrade picocli to 2.0.3 from 0.9.8. (LOG4J2-2088)

  • [TagLib] Update servlet-api provided dependency from 2.5 to 3.0.1. (LOG4J2-2089)

  • Update Apache Kafka kafka-clients from 0.11.0.1 to 1.0.0. (LOG4J2-2096)

  • Jackson dependencies for 2.9.2 incorrectly bring in jackson-annotations 2.9.0 instead of 2.9.2. (LOG4J2-2117)

Fixed

  • Nested pattern layout options broken. (LOG4J2-1216)

  • Until this change, messages appeared out of order in log file any time when the async logging queue was full. With this change, messages are only logged out of order to prevent deadlock when Log4j2 detects recursive logging while the queue is full. (LOG4J2-2031)

  • CompositeConfiguration supports Reconfiguration. PR #115. (LOG4J2-2036)

  • Exception java.nio.charset.UnsupportedCharsetException: cp65001 in 2.9.0. (LOG4J2-2053)

  • If Log4j is used as the Tomcat logging implementation startup might fail if an application also uses Log4j. (LOG4J2-2055)

  • AbstractDatabaseManager should make a copy of LogEvents before holding references to them: AsyncLogger log events are mutable. (LOG4J2-2060)

  • Log4j1XmlLayout does not provide the entire stack trace, it is missing the caused by information. (LOG4J2-2070)

  • Log4j-config.xsd should make AppenderRef optional for each Logger element. (LOG4J2-2073)

  • The console appender should say why it cannot load JAnsi. (LOG4J2-2074)

  • Wrong Apache Commons CSV version referenced in the Javadoc of CsvParameterLayout. (LOG4J2-2085)

  • Jansi now needs to be enabled explicitly (by setting system property log4j.skipJansi to false). To avoid causing problems for web applications, Log4j will no longer automatically try to load Jansi without explicit configuration. (LOG4J2-2087)

  • Log4j respects the configured "log4j2.is.webapp" property (LOG4J2-2091)

  • LevelMixIn class for Jackson is coded incorrectly (LOG4J2-2100)

  • Non-string value in MapMessage caused ClassCastException. (LOG4J2-2101)

  • MapMessage JSON encoding will escape keys and values. (LOG4J2-2102)

  • MapMessage supports both StringBuilderFormattable and MultiFormatMessage. (LOG4J2-2107)

  • XML Schema for DynamicFilterThreshold does not accept multiple KeyValuePairs. (LOG4J2-2289)

2.9.1

Release date

2017-09-17

This release contains bugfixes and minor enhancements.

As of Log4j 2.9.0, the Log4j API was modified to use java.util.ServiceLoader to locate Log4j implementations, although the former binding mechanism is still supported. The Log4j JAR is now a multi-release JAR to provide implementations of the Java 9 specific classes. Multi-release JARs are not supported by the OSGi specification so OSGi modules will not be able to take advantage of these implementations but will not lose functionality as they will fall back to the implementations used in Java 7 and 8. More details on the new features and fixes are itemized below.

Note that subsequent to the 2.9.0 release, for security reasons, SerializedLayout is deprecated and no longer used as default in the Socket and JMS appenders. SerializedLayout can still be used as before, but has to be specified explicitly. To retain old behaviour, you have to change configuration like:

<Appenders>
  <Socket name="socket" host="localhost" port="9500"/>
</Appenders>

into:

<Appenders>
  <Socket name="socket" host="localhost" port="9500">
    <SerializedLayout/>
  </Socket>
</Appenders>

We do, however, discourage the use of SerializedLayout and recommend JsonLayout as a replacement:

<Appenders>
  <Socket name="socket" host="localhost" port="9500">
    <JsonLayout properties="true"/>
  </Socket>
</Appenders>

Note that subsequent to the 2.9.0 release, for security reasons, Log4j does not process DTD in XML files. If you used DTD for including snippets, you have to use XInclude or Composite Configuration instead.

The Log4j 2.9.1 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.9.1 requires a minimum of Java 7 to build and run. Log4j 2.3 was the last release that supported Java 6.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Changed

  • Use a class' canonical name instead of name to create its logger name. (LOG4J2-2023)

  • Update Jackson from 2.9.0 to 2.9.1 (fix for Java 9.) (LOG4J2-2043)

  • Update Apache Commons CSV from 1.4 to 1.5. (LOG4J2-2044)

  • Update javax.mail from 1.5.6 to 1.6.0. (LOG4J2-2045)

  • Update Apache Commons Compress from 1.13 to 1.14. (LOG4J2-2046)

  • Update Cassandra driver from 3.1.0 to 3.1.4. (LOG4J2-2047)

  • Update Apache Kafka Client from 0.11.0.0 to 0.11.0.1. (LOG4J2-2049)

Fixed

  • Prevent ConcurrentModificationException with AsyncLoggerConfig. (LOG4J2-1914)

  • ClassNotFoundException when making all loggers asynchronous under OSGi environment. (LOG4J2-1936)

  • Prevent ConcurrentModificationException with AsyncLoggerConfig. (LOG4J2-1988)

  • java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setFeature(). (LOG4J2-2026)

  • Java 9 StackLocator was not properly skipping the initial stack frames. (LOG4J2-2028)

  • Marker examples should not use deprecated flow APIs. (LOG4J2-2029)

  • Inspect all known ClassLoaders to locate the service provider. (LOG4J2-2030)

  • Fix documentation to clarify disruptor-3.3.4 is now required for async loggers (previously the docs referred to disruptor-3.3.3 which was never released). (LOG4J2-2035)

  • Increase default queue size for AsyncAppender from 128 to 1024. (LOG4J2-2048)

2.9.0

Release date

2017-08-26

This release contains the first support of Java 9 as well as bugfixes and minor enhancements. The Log4j API was modified to use java.util.ServiceLoader to locate Log4j implementations, although the former binding mechanism is still supported. The Log4j JAR is now a multi-release JAR to provide implementations of the Java 9 specific classes. Multi-release JARs are not supported by the OSGi specification so OSGi modules will not be able to take advantage of these implementations but will not lose functionality as they will fall back to the implementations used in Java 7 and 8. More details on the new features and fixes are itemized below.

Note that subsequent to the 2.9.0 release, for security reasons, SerializedLayout is deprecated and no longer used as default in the Socket and JMS appenders. SerializedLayout can still be used as before, but has to be specified explicitly. To retain old behaviour, you have to change configuration like:

<Appenders>
  <Socket name="socket" host="localhost" port="9500"/>
</Appenders>

into:

<Appenders>
  <Socket name="socket" host="localhost" port="9500">
    <SerializedLayout/>
  </Socket>
</Appenders>

We do, however, discourage the use of SerializedLayout and recommend JsonLayout as a replacement:

<Appenders>
  <Socket name="socket" host="localhost" port="9500">
    <JsonLayout properties="true"/>
  </Socket>
</Appenders>

Note that subsequent to the 2.9.0 release, for security reasons, Log4j does not process DTD in XML files. If you used DTD for including snippets, you have to use XInclude or Composite Configuration instead.

The Log4j 2.9.0 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.9.0 requires a minimum of Java 7 to build and run. Log4j 2.3 was the last release that supported Java 6.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • The JMS Appender should use a JMS MapMessage for a Log4j MapMessage. (LOG4J2-1294)

  • Add support for Java 9 StackWalker. (LOG4J2-1359)

  • Generic HTTP appender. (LOG4J2-1442)

  • Configurable Log File Permissions with PosixFilePermission. (LOG4J2-1699)

  • Temporary compress directory during rollover (#88). (LOG4J2-1766)

  • Log4j2 will now print all internal logging to the console if system property log4j2.debug is defined with any value (or no value). (LOG4J2-1813)

  • Added wrapper classes CustomLoggerGenerator and ExtendedLoggerGenerator to avoid class name with a dollar ($) character which has special meaning in many *nix command line environments. (LOG4J2-1814)

  • Support null byte delimiter in GelfLayout. (LOG4J2-1854)

  • Add an optional random delay in TimeBasedTriggeringPolicy (LOG4J2-1855)

  • Shortcut to add Property and KeyValuePair component in ConfigurationBuilder. (LOG4J2-1860)

  • Support capped collections for MongoDb appender. (LOG4J2-1864)

  • Added methods ::writeBytes(ByteBuffer) and ::writeBytes(byte[], int, int) to ByteBufferDestination interface and use these methods in TextEncoderHelper where possible to prepare for future enhancements to reduce lock contention. (LOG4J2-1874)

  • Warn when a configuration file for an inactive ConfigurationFactory is found. (LOG4J2-1880)

  • Added process ID (pid) pattern converter. (LOG4J2-1884)

  • Add forEach() methods to org.apache.logging.log4j.message.MapMessage. (LOG4J2-1930)

  • Add containsKey() methods to org.apache.logging.log4j.message.MapMessage. (LOG4J2-1932)

  • JMS Appender does not know how to recover from a broken connection. (LOG4J2-1934)

  • Add with(String, primitive) methods to org.apache.logging.log4j.message.MapMessage. (LOG4J2-1935)

  • Generate source jas for all test jars. (LOG4J2-1945)

  • JMS Appender should be able to connect to a broker (later) even it is not present at configuration time. (LOG4J2-1955)

  • JsonLayout, XmlLayout and YamlLayout support 0-byte termination of log events. (LOG4J2-1981)

  • Public API for parsing the output from JsonLayout/XmlLayout/YamlLayout into a LogEvent. (LOG4J2-1986)

  • Support printing multiple StructuredData elements in RFC5424Layout. (LOG4J2-2008)

Changed

  • Allow for bufferSize=0 in SMTP appender. (LOG4J2-1071)

  • Async Loggers no longer use deprecated LMAX Disruptor APIs. (Disruptor-3.3.3 or higher is now required.) (LOG4J2-1261)

  • Add more detail to WARN "Ignoring log event" messages printed to the console after log4j was shut down. (LOG4J2-1801)

  • Move server components from log4j-core to new log4-server module. (LOG4J2-1851)

  • Update ZeroMQ’s JeroMQ from 0.3.6 to 0.4.0. (LOG4J2-1868)

  • Update Kafka client from 0.10.1.1 to 0.10.2.0 (LOG4J2-1869)

  • Update JavaMail from 1.5.5 to 1.5.6. (LOG4J2-1872)

  • Missing documentation for Max index limit in DefaultRolloverStrategy. (LOG4J2-1877)

  • Update JAnsi from 1.14 to 1.15. (LOG4J2-1879)

  • Add missing getters to classes in package org.apache.logging.log4j.core.net.ssl. (LOG4J2-1899)

  • Update JAnsi from 1.15 to 1.16. (LOG4J2-1900)

  • Improved error message when misconfigured with multiple incompatible appenders targeting same file. (LOG4J2-1908)

  • Support using java.util.ServiceLoader to locate Log4j 2 API providers. (LOG4J2-1917)

  • Facilitate log4j use in Android applications: remove dependency on RMI and Management APIs from log4j-api. (LOG4J2-1926)

  • Add support for DirectWriteRolloverStrategy to RollingRandomAccessFileAppender. (LOG4J2-1928)

  • Update Jackson from 2.8.7 to 2.8.9. (LOG4J2-1938)

  • Fix docker build with jdk9 requirements (#84). (LOG4J2-1950)

  • Configurations with multiple root loggers now fail loudly. (LOG4J2-1954)

  • JMS Appender broker password should be a char[], not a String. (LOG4J2-1956)

  • Deprecate SerializedLayout and remove it as default. (LOG4J2-1958)

  • Disable DTD processing in XML configuration files. (LOG4J2-1959)

  • Update ZeroMQ’s JeroMQ from 0.4.0 to 0.4.1. (LOG4J2-1960)

  • Update Kafka client from 0.10.2.0 to 0.11.0.0 (LOG4J2-1962)

  • Include separator option of PatternLayout in manual (and other updates). (LOG4J2-1966)

  • Update HdrHistogram from 2.1.8 to 2.1.9. (LOG4J2-1970)

  • Update ZeroMQ’s JeroMQ from 0.4.1 to 0.4.2. (LOG4J2-1974)

  • Update javax.persistence from 2.1.0 to 2.1.1. (LOG4J2-1975)

  • Update org.osgi.core from 4.3.1 to 6.0.0. (LOG4J2-1976)

  • Allow maxLength of StructuredData to be specified by the user. (LOG4J2-1984)

  • Refactor SimpleMessage to be concise and clear (#100) (LOG4J2-1991)

  • Replace JCommander command line parser with picocli to let users run Log4j2 utility applications without requiring an external dependency. (LOG4J2-2011)

  • Allow KeyStoreConfiguration and TrustStoreConfiguration to find files as resources. (LOG4J2-2015)

  • Update Jackson from 2.8.9 to 2.9.0. (LOG4J2-2017)

  • Remove default layout from KafkaAppender. (LOG4J2-2020)

  • RFC5424Layout now prints the process id. (LOG4J2-2022)

  • Use a class' canonical name instead of name to create its logger name. (LOG4J2-2023)

  • Update SLF4J from 1.7.24 to 1.7.25.

Fixed

  • SocketAppender will lose several events after re-connection to server. (LOG4J2-1311)

  • Prevent NullPointerException when a file name is specified with the DirectWriteRolloverStrategy. (LOG4J2-1833)

  • Ensure the ThreadLocal StringBuilder in ParameterizedMessage won’t hold excessively much memory after logging a long message. (LOG4J2-1858)

  • Fix configuration documentation. (LOG4J2-1867)

  • More reliable checking for runtime dependencies. (LOG4J2-1876)

  • Fix documentation about default additivity value for loggers. (LOG4J2-1885)

  • Log4j throws a java.nio.charset.UnsupportedCharsetException: cp65001. (LOG4J2-1888)

  • Improve the documentation of the DynamicThresholdFilter. (LOG4J2-1911)

  • CompositeConfiguration logs warning "Unable to determine URI for configuration." However, the reconfiguration is completed. (LOG4J2-1912)

  • ScriptEngineManager is not available in Android and causes a NoClassDefFoundError. (LOG4J2-1920)

  • EOFException with FormattedMessage. (LOG4J2-1929)

  • The eventPrefix attribute was being ignored in the RFC5424Layout. (LOG4J2-1943)

  • Trim levels read from properties file to remove trailing spaces. (LOG4J2-1948)

  • JndiManager is not released when the JmsAppender builder catches an exception trying to build itself. (LOG4J2-1953)

  • Reconfigure breaks DirectWriteRolloverStrategy. (LOG4J2-1961)

  • Dynamic reconfiguration does not work for filePattern of RollingFile. (LOG4J2-1964)

  • ClassCastException: org.eclipse.osgi.internal.loader.SystemBundleLoader$1 cannot be cast to java.lang.ClassLoader. (LOG4J2-1971)

  • Register log4j-core as an OSGi service. Skip tests for LOG4J2-1766 on macOS. Use group "staff" for LOG4J2-1699 test on macOS. (LOG4J2-1971)

  • Consider the StringBuilder’s capacity instead of content length when trimming. (LOG4J2-1977)

  • Log4j-config.xsd only allows one AppenderRef element for each Logger element. (LOG4J2-1982)

  • Fix default buffer size to match documentation (from 8102 to 8192 a.k.a. 8KB.) (LOG4J2-1985)

  • Log4J JUL Bridge and RMI Security Manager causes access denied ("java.util.logging.LoggingPermission" "control") (LOG4J2-1987)

  • Clarify Javadoc for AbstractTriggeringPolicy. (LOG4J2-1989)

  • ConcurrentModificationException logging a parameter of type Map. (LOG4J2-1990)

  • Fix compiler warnings in LoggerConfigTest. (LOG4J2-1993)

  • TcpSocketServer does not close accepted Sockets. (LOG4J2-1994)

  • HighlightConverter converts all unrecognized levels to DEBUG. (LOG4J2-1999)

  • StyleConverter.newInstance argument validation is incorrect. (LOG4J2-2001)

  • No compression when using a separate drive in Linux. (LOG4J2-2012)

  • SslSocketManager does not apply SSLContext on TCP reconnect. (LOG4J2-2013)

  • Mark FileRenameAction as successful when using alternative ways to move files. (LOG4J2-2016)

  • Fix incorrect documentation for LoggerNameLevelRewritePolicy. (LOG4J2-2018)

  • Parameter of mdcId in SyslogAppender has no default value. (LOG4J2-922)

2.8.2

Release date

2017-04-02

This release primarily contains bugfixes and minor enhancements. More details on the new features and fixes are itemized below.

Note that subsequent to the 2.6 release a minor source incompatibility was found due to the addition of new methods to the Logger interface. If you have code that does:

logger.error(null, “This is the log message”, throwable);

or similar with any log level you will get a compiler error saying the reference is ambiguous. To correct this either do:

logger.error(“This is the log message”, throwable);

or

logger.error((Marker) null, “This is the log message”, throwable);

The Log4j 2.8.2 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.8.2 requires a minimum of Java 7 to build and run. Log4j 2.3 was the last release that supported Java 6.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Add support for appending common suffix to each line of extended and root throwable stack trace. (LOG4J2-1838)

  • Add support for appending common suffix to each line of throwable stack trace. (LOG4J2-1843)

  • Add JSON encoding support to EncodingPatternConverter %encode{}. (LOG4J2-1848)

  • Add support for filtering input in TcpSocketServer and UdpSocketServer. (LOG4J2-1863)

Changed

  • Move integration tests to their own module to speed up build. (LOG4J2-1827)

  • Update Jackson from 2.8.6 to 2.8.7. (LOG4J2-1856)

Fixed

  • Log4j 2.8 can lose exceptions when a security manager is present. (LOG4J2-1820)

  • NullPointerException in HtmlLayout. (LOG4J2-1831)

  • Fix documentation about the licensing for JeroMQ. (LOG4J2-1835)

  • Update the API version to 2.6.0. (LOG4J2-1836)

  • Fix typo in %replace converter documentation. (LOG4J2-1840)

  • Handle when LogEvent.getLoggerName() returns null in KafkaAppender. (LOG4J2-1845)

  • Handle when LogEvent.getLoggerName() returns null in LoggerNameLevelRewritePolicy. (LOG4J2-1846)

  • Fixed daylight savings time (DST) issue with FixedDateFormat. (LOG4J2-1849)

  • Fix CassandraRule and unit tests on Windows. (LOG4J2-1850)

  • The default value of RandomAccessFileAppender.Builder append field is wrong. (LOG4J2-1853)

  • Fix JavaDoc on org.apache.logging.log4j.ThreadContext about inheritance. (LOG4J2-1861)

  • Fix JavaDoc about @Order and OrderComparator ordering. (LOG4J2-1862)

2.8.1

Release date

2017-02-26

This release primarily contains bugfixes and minor enhancements. More details on the new features and fixes are itemized below.

Note that subsequent to the 2.6 release a minor source incompatibility was found due to the addition of new methods to the Logger interface. If you have code that does:

logger.error(null, “This is the log message”, throwable);

or similar with any log level you will get a compiler error saying the reference is ambiguous. To correct this either do:

logger.error(“This is the log message”, throwable);

or

logger.error((Marker) null, “This is the log message”, throwable);

The Log4j 2.8.1 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.8.1 requires a minimum of Java 7 to build and run. Log4j 2.3 was the last release that supported Java 6.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • [core] Add and implement LogEvent.toImmutable(). (LOG4J2-1807)

  • Remove deprecation on MessageSupplier lambda functions in Logger API. (LOG4J2-1823)

Changed

  • Update to use Logback 1.1.10 and then Logback 1.2 for tests. (LOG4J2-1810)

  • Improved error message when log4j 2 configuration file not found. (LOG4J2-1812)

  • Update Jackson from 2.8.5 to 2.8.6. (LOG4J2-1819)

  • Update SLF4J to 1.7.24. (LOG4J2-1822)

Fixed

  • Fix ClassNotFoundException org.apache.logging.log4j.core.util.ExecutorServices in OSGi tests. (LOG4J2-1753)

  • Fixed bug in PropertiesUtil::getCharsetProperty that caused UnsupportedCharsetException for ConsoleAppender. (LOG4J2-1799)

  • Report errors when sending to Kafka when using syncSend=false. (LOG4J2-1800)

  • Fix Maven POM to ensure JMH generated classes in log4j-perf are included in benchmarks jar. (LOG4J2-1803)

  • Allow %i in file pattern to be preceded with characters other than just '-'. (LOG4J2-1804)

  • Fixed rare race condition in FixedDateFormat, made FixedDateFormat::millisSinceMidnight method public. (LOG4J2-1805)

  • Fix Javadoc for DefaultRolloverStrategy::purgeAscending (LOG4J2-1806)

  • Change minOccur to minOccurs in Log4j-config.xsd. (LOG4J2-1816)

  • Fix rollover to work when filePattern contains no directory components. (LOG4J2-1818)

2.8

Release date

2017-01-21

This release contains several bugfixes and new features. The new features include the ability to have the RollingFileAppender log directly to the archive files. More details on the new features and fixes are itemized below.

Note that subsequent to the 2.6 release a minor source incompatibility was found due to the addition of new methods to the Logger interface. If you have code that does:

logger.error(null, “This is the log message”, throwable);

or similar with any log level you will get a compiler error saying the reference is ambiguous. To correct this either do:

logger.error(“This is the log message”, throwable);

or

logger.error((Marker) null, “This is the log message”, throwable);

The Log4j 2.8 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.8 requires a minimum of Java 7 to build and run. Log4j 2.3 was the last release that supported Java 6.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Make DefaultRolloverStrategy more efficient when renaming files. Add nomax option to the fileIndex attribute. (LOG4J2-1032)

  • RollingFileAppender now supports omitting the file name and writing directly to the archive files. (LOG4J2-1101)

  • Allow default value in property to be a Lookup. (LOG4J2-1243)

  • Add documentation regarding YAML configuration format. (LOG4J2-1379)

  • Added public method ThreadContext::getThreadContextMap; removed class ThreadContextAccess. (LOG4J2-1660)

  • Introduce interfaces IndexedStringMap and IndexedReadOnlyStringMap, supporting garbage-free iteration over sorted map. (LOG4J2-1681)

  • Add a Builder to ScriptPatternSelector and deprecate ScriptPatternSelector.createSelector(). (LOG4J2-1695)

  • Add a Builder to MarkerPatternSelector and deprecate MarkerPatternSelector.createSelector(). (LOG4J2-1696)

  • Add a SerializerBuilder to PatternLayout and deprecate PatternLayout.createSerializer(). (LOG4J2-1697)

  • Add a Builder to RandomAccessFileAppender and deprecate RandomAccessFileAppender.createAppender(). (LOG4J2-1701)

  • Add a Builder to MemoryMappedFileAppender and deprecate MemoryMappedFileAppender.createAppender(). (LOG4J2-1703)

  • Add a Builder to RollingRandomAccessFileAppender and deprecate RollingRandomAccessFileAppender.createAppender(). (LOG4J2-1704)

  • Allow TCP Socket Appender to set socket options. (LOG4J2-1707)

  • Allow Secure Socket Appender to set socket options. (LOG4J2-1708)

  • Add a Builder to SyslogAppender and deprecate SyslogAppender.createAppender(). (LOG4J2-1709)

  • Introduce marker interface AsynchronouslyFormattable. (LOG4J2-1718)

  • Add Apache Cassandra appender and ColumnMapping plugin. (LOG4J2-1730)

  • Add SyncSend attribute to KafkaAppender (as in KafkaLog4jAppender). (LOG4J2-1733)

  • Add a Builder to SyslogLayout and deprecate SyslogLayout.createLayout(Facility, boolean, String, Charset). (LOG4J2-1737)

  • Add a Builder to JsonLayout and deprecate org.apache.logging.log4j.core.layout.JsonLayout.createLayout(Configuration, boolean, boolean, boolean, boolean, boolean, boolean, String, String, Charset, boolean). (LOG4J2-1738)

  • Add Builder to KafkaAppender and deprecate KafkaAppender.createAppender(Layout, Filter, String, boolean, String, Property[], Configuration). (LOG4J2-1739)

  • Add TypeConverter and constraint validators for java.net.InetAddress and port numbers. (LOG4J2-1755)

  • Add TypeConverter for java.nio.file.Path. (LOG4J2-1758)

  • Add TypeConverter for java.util.UUID. (LOG4J2-1759)

  • Use MethodHandle in ContextDataFactory cached constructor. (LOG4J2-1764)

  • Add a Builder to JdbcAppender and deprecate JdbcAppender.createAppender(). (LOG4J2-1770)

  • Add a Builder to ColumnConfig and deprecate ColumnConfig.createColumnConfig(). (LOG4J2-1771)

  • Add StatusLoggerRule to allow unit tests to set a status level. (LOG4J2-1773)

  • Document how to exclude transitive conflicting dependencies in Maven and Gradle. (LOG4J2-1787)

  • Add non-string data type support to JdbcAppender via new ColumnMapping plugin. (LOG4J2-424)

  • Refactor SyslogAppender so that Layout is a Plugin element. (LOG4J2-969)

Changed

  • The log4j-slf4j-impl module now declares a runtime dependency on log4j-core. While not technically required, this makes the log4j-slf4j-impl module behave similarly to slf4j-log4j12, and facilitates migration to Log4j 2. (LOG4J2-1302)

  • Update JeroMQ from 0.3.5 to 0.3.6. (LOG4J2-1641)

  • Inefficient locking in AbstractLoggerAdapter. (LOG4J2-1644)

  • Migrate to Mockito 2.x in unit tests. (LOG4J2-1646)

  • Update Commons Lang from 3.4 to 3.5. (LOG4J2-1647)

  • Update Jackson from 2.8.3 to 2.8.4. (LOG4J2-1655)

  • Update Apache Flume from 1.6.0 to 1.7.0. (LOG4J2-1656)

  • Update LMAX Disruptor from 3.3.5 to 3.3.6. (LOG4J2-1698)

  • Update Jansi from 1.13 to 1.14. (LOG4J2-1700)

  • Update Jackson from 2.8.4 to 2.8.5. (LOG4J2-1735)

  • Update Kafka from 0.10.0.1 to 0.10.1.1. (LOG4J2-1750)

  • Update liquibase-core from 3.5.1 to 3.5.3. (LOG4J2-1751)

  • Replace MockEJB dependency in unit tests with Spring Test and Mockito. (LOG4J2-1774)

  • Update Conversant Disruptor from 1.2.7 to 1.2.10 (LOG4J2-1781)

Fixed

  • Improve LogEvent serialization to handle non-serializable Messages and deserializing when required classes are missing. (LOG4J2-1226)

  • CronTriggeringPolicy raise exception and fail to rollover log file when evaluateOnStartup is true. (LOG4J2-1474)

  • Configurable JVM shutdown hook timeout. (LOG4J2-1623)

  • Fixed file locking regression in FileAppender introduced in 2.6. (LOG4J2-1628)

  • Console Appender does not pick up Oracle Java 8’s sun.stdout.encoding and sun.stderr.encoding. (LOG4J2-1636)

  • Fixed problems when used in OSGi containers (IllegalAccessError, NoClassDefFoundError). (LOG4J2-1637)

  • Fix MemoryMappedFileAppender.createAppender() Javadoc for immediateFlush. (LOG4J2-1639)

  • DefaultShutdownCallbackRegistry can throw a NoClassDefFoundError. (LOG4J2-1642)

  • Immutable empty StringMap. (LOG4J2-1645)

  • Insure the ConfigurationScheduler shuts down without blocking. (LOG4J2-1649)

  • CronTriggeringPolicy would use the wrong date/time when rolling over and create multiple triggering policies on reconfiguration. (LOG4J2-1653)

  • Prevent NPE in ThreadContextMapFactory::createThreadContextMap when initializing Log4j with Configurator::initialize and the BasicContextSelector is used. (LOG4J2-1658)

  • Ensure SortedArrayStringMap can be serialized and deserialized without errors regardless of content. (LOG4J2-1663)

  • Improve OSGi unit tests. (LOG4J2-1664)

  • (GC) Avoid allocating temporary objects in IntegerPatternConverter. (LOG4J2-1665)

  • (GC) Avoid allocating temporary objects in RelativeTimePatternConverter. (LOG4J2-1666)

  • (GC) Avoid allocating temporary objects in SequenceNumberPatternConverter. (LOG4J2-1667)

  • (GC) Avoid allocating temporary objects in MarkerPatternConverter. (LOG4J2-1668)

  • (GC) Avoid allocating temporary objects in MaxLengthConverter. (LOG4J2-1669)

  • (GC) Avoid allocating temporary objects in EqualsReplacementConverter. (LOG4J2-1670)

  • (GC) Avoid allocating temporary objects in EqualsIgnoreCaseReplacementConverter. (LOG4J2-1671)

  • (GC) Avoid allocating temporary objects in LevelRangeFilter. (LOG4J2-1672)

  • (GC) Avoid allocating temporary objects in MarkerFilter. (LOG4J2-1673)

  • (GC) Avoid allocating temporary objects in ThresholdFilter. (LOG4J2-1674)

  • Some LogEvents may not carry a Throwable (Use Message.getThrowable() in log(Message) methods.) (LOG4J2-1676)

  • (GC) Avoid allocating temporary objects in MapFilter. (LOG4J2-1677)

  • (GC) Avoid allocating temporary objects in ThreadContextMapFilter. (LOG4J2-1678)

  • (GC) Avoid allocating temporary objects in StructuredDataFilter. (LOG4J2-1679)

  • (GC) Avoid allocating temporary objects in TimeFilter. (LOG4J2-1680)

  • Logger using LocalizedMessageFactory prints key instead of message. (LOG4J2-1682)

  • (GC) Avoid allocating temporary objects in MapMessage. (LOG4J2-1683)

  • Option 'disableAnsi' in PatternLayout to unconditionally disable ANSI escape codes. (LOG4J2-1685)

  • NPE in ThrowableProxy when resolving stack in Java EE/OSGi environment. (LOG4J2-1687)

  • Fixed bug where elements of a log message parameter array were nulled out in garbage-free mode. (LOG4J2-1688)

  • Add CleanableThreadContextMap interface supporting method removeAll(Iterable<String>). (LOG4J2-1689)

  • Add putAll() method to CloseableThreadContext. (LOG4J2-1692)

  • Make TimeFilter usable as global filter and as logger filter. (LOG4J2-1706)

  • Pick up bug fixes from Apache Commons Lang’s org.apache.commons.lang3.time package. (LOG4J2-1712)

  • (GC) Avoid allocating temporary objects in AbstractStyleNameConverter. (LOG4J2-1714)

  • (GC) Avoid allocating temporary objects in NdcPatternConverter. (Note that use of the ThreadContext stack is not garbage-free.) (LOG4J2-1715)

  • (GC) Avoid allocating temporary objects in MapPatternConverter. (Note that constructing a MapMessage is not garbage-free.) (LOG4J2-1716)

  • (GC) Avoid allocating temporary objects in EncodingPatternConverter. (LOG4J2-1717)

  • Fixed race condition in ObjectMessage and SimpleMessage, ensuring that the log message contains the value the object has during the logging call. (LOG4J2-1719)

  • Make GelfLayout independent of Jackson. (LOG4J2-1720)

  • (GC) Avoid allocating temporary objects in VariablesNotEmptyReplacementConverter. (LOG4J2-1722)

  • Unwanted transitive dependency on geronimo-jms_1.1_spec causes OSGi tests to fail. (LOG4J2-1723)

  • Using variables in GelfLayout’s additional fields at runtime. (LOG4J2-1724)

  • SslSocketManager now respects connectTimeoutMillis. (LOG4J2-1731)

  • SslSocketManagerFactory might leak Sockets when certain startup errors occur. (LOG4J2-1734)

  • TcpSocketManagerFactory might leak Sockets when certain startup errors occur. (LOG4J2-1736)

  • Add CronTriggeringPolicy programmatically leads to NPE. (LOG4J2-1740)

  • CompositeConfiguration does not add filters to appenderRefs. (LOG4J2-1743)

  • The custom logger Generate tool no longer requires the log4j-api module on the classpath. (LOG4J2-1744)

  • Do not use non-daemon thread pool for rollover tasks. (LOG4J2-1748)

  • Adds xmlns in schema and some other tags. (LOG4J2-1756)

  • Add Builder to GelfLayout. (LOG4J2-1762)

  • Fixed concurrency issue affecting all layouts except PatternLayout and GelfLayout, which caused scrambled output and exceptions when logging synchronously from multiple threads. (LOG4J2-1769)

  • Fixed bug where AsyncLogger did not resolve configuration properties. (LOG4J2-1779)

  • Eliminate the use of the ExecutorServices in the LoggerContext. (LOG4J2-1780)

  • ConfigurationScheduler now preserves interrupt flag during stop. (LOG4J2-1786)

  • Cannot define both filters and separator for PatternLayout %xEx. (LOG4J2-2195)

  • RootThrowablePatternConverter does not use TextRenderer or line separator options. (LOG4J2-2221)

2.7

Release date

2016-10-02

This release contains several bugfixes and new features. The new features include new logging API modules for Scala 2.10 and 2.11, and support for various non-blocking queue implementations in AsyncAppender. Furthermore the ThreadContext map can now be configured to be garbage-free, and users can now inject context data from other sources than ThreadContext. Context data values can be any Object, not just Strings. More details on the fixes are itemized below.

Note that subsequent to the 2.6 release a minor source incompatibility was found due to the addition of new methods to the Logger interface. If you have code that does:

logger.error(null, “This is the log message”, throwable);

or similar with any log level you will get a compiler error saying the reference is ambiguous. To correct this either do:

logger.error(“This is the log message”, throwable);

or

logger.error((Marker) null, “This is the log message”, throwable);

The Log4j 2.7 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.7 requires a minimum of Java 7 to build and run. Log4j 2.3 was the last release that supported Java 6.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Users can now inject context data from other sources than ThreadContext. Values can be any Object, not just Strings. (LOG4J2-1010)

  • Added Logging API for Scala 2.10 and 2.11. (LOG4J2-1181)

  • (GC) Added support for garbage-free ThreadContext map. Disabled by default, users need to enable this explicitly. (LOG4J2-1349)

  • Added optional support for Conversant DisruptorBlockingQueue in AsyncAppender. (LOG4J2-1430)

  • Added optional support for JCTools MPSC bounded lock-free queue in AsyncAppender. (LOG4J2-1439)

  • (GC) Changed LogEvent’s internal data structure for context data to be garbage-free. Added method LogEvent#getContextData(), deprecated method #getContextMap(). (LOG4J2-1447)

  • [PatternLayout] Add an ANSI option to %message. (LOG4J2-1458)

  • [PatternLayout] Add an ANSI option to %xThrowable. (LOG4J2-1471)

  • org.apache.logging.log4j.core.LoggerContext now implements Closeable. (LOG4J2-1472)

  • FileAppender is now able to create files on-demand. (LOG4J2-1501)

  • RollingFileAppender is now able to create files on-demand. (LOG4J2-1504)

  • Create a Builder for the FileAppender plugin to facilitate adding attributes in the future. (LOG4J2-1505)

  • Allow Builders to be completely generic. (LOG4J2-1507)

  • Allow a Builder to subclass another Builder. (LOG4J2-1508)

  • Added options to exclude stack trace from JSON, XML and YAML layouts. (LOG4J2-1512)

  • Add ThreadContextMap2 interface supporting method putAll(Map<String, String>). (LOG4J2-1516)

  • Add ThreadContext.putAll(Map<String, String>). (LOG4J2-1519)

  • Add JUnit Rule implementations to manage the thread context. (LOG4J2-1520)

  • Added ability to generate Log4j 2-style XML configuration file from ConfigurationBuilder. (LOG4J2-1528)

  • Added Core API Configurator.shutdown(LoggerContext, long, TimeUnit). (LOG4J2-1539)

  • The Core AbstractManager now tracks its LoggerContext. (LOG4J2-1540)

  • The Core AbstractConfiguration now tracks its LoggerContext and add Configuration.getLoggerContext(). (LOG4J2-1547)

  • AbstractManager now implements AutoCloseable. (LOG4J2-1553)

  • Add a Builder for the SocketAppender (deprecates factory method). (LOG4J2-1557)

  • SocketAppender now supports IO buffering. (LOG4J2-1558)

  • Added support for java.util.concurrent.LinkedTransferQueue to AsyncAppender. (LOG4J2-1568)

  • Add a Builder to the RoutingAppender and deprecate factory method. (LOG4J2-1577)

  • RoutingAppender can be configured with scripts. Add Script in a Routes element. (LOG4J2-1578)

  • Add a ScriptAppenderSelector to create an Appender specified by a Script. (LOG4J2-1597)

  • Add a Builder to ServletAppender and deprecate factory method. (LOG4J2-1609)

Changed

  • Updated Jackson from 2.7.5 to 2.8.0. (LOG4J2-1458)

  • Updated JMS test from ActiveMQ 5.13.3 to 5.13.4. (LOG4J2-1487)

  • Updated Jackson from 2.8.0 to 2.8.1. (LOG4J2-1494)

  • Updated LMAX Disruptor from 3.3.4 to 3.3.5. (LOG4J2-1495)

  • Updated Kafka client from 0.9.1.0 to 0.10.0.0. (LOG4J2-1496)

  • Updated Kafka client from 0.10.0.0 to 0.10.0.1. (LOG4J2-1533)

  • Removed deprecated Core API org.apache.logging.log4j.core.util.Constants.UTF_8. (LOG4J2-1543)

  • Removed deprecated Core API org.apache.logging.log4j.core.util.Assert.requireNonNull(T, String). (LOG4J2-1544)

  • Removed deprecated Web API org.apache.logging.log4j.web.WebLookup.getServletContext(). (LOG4J2-1545)

  • Updated JMS test from ActiveMQ 5.13.4 to 5.14.0. (LOG4J2-1551)

  • Custom Log4j threads now extend Log4jThread. (LOG4J2-1556)

  • Updated Jackson from 2.8.1 to 2.8.2. (LOG4J2-1569)

  • Allow the RollingFileAppender to use default pattern layout. (LOG4J2-1574)

  • Updated Jackson from 2.8.2 to 2.8.3. (LOG4J2-1598)

  • Log4j2 TcpSocketServer in background. (LOG4J2-1604)

  • Improve error messages for TcpSocketServer and UdpSocketServer. (LOG4J2-1605)

  • Update Apache Commons Compress from 1.12 to 1.13. (LOG4J2-1757)

Fixed

  • When starting on Google App Engine, Interpolator now suppresses the NoClassDefFoundError stack trace for the jvmrunargs lookup. (LOG4J2-1051)

  • Documented that JVM Input Arguments Lookup (JMX) is not available on Google App Engine. (LOG4J2-1199)

  • org.apache.logging.log4j.core.appender.routing.IdlePurgePolicy was not working correctly. (LOG4J2-1235)

  • Log4j threads are no longer leaking on Tomcat shutdown. (LOG4J2-1259)

  • Prevent NullPointerException in FastDateParser$TimeZoneStrategy. (LOG4J2-1279)

  • Properties declared in configuration can now have their value either in the element body or in an attribute named "value". (LOG4J2-1313)

  • Support Property values to be specified in configuration as a value attribute as well as an element. (LOG4J2-1313)

  • Support loading custom plugins from jar files and directories whose classpath entries use the "vfs" URL protocol. (LOG4J2-1320)

  • (GC) HighlightConverter and StyleConverter are now GC-free. (LOG4J2-1341)

  • (GC) Added method getParameter() to ObjectMessage (and ReusableObjectMessage). (LOG4J2-1438)

  • Allow comma separated agents, host list to be passed to FlumeAppender. (LOG4J2-1448)

  • Fixed class loader deadlock when using async logging and extended stack trace pattern. (LOG4J2-1457)

  • [OSGi] Fixed missing import package. (LOG4J2-1467)

  • Fixed improper header in CsvParameterLayout. (LOG4J2-1482)

  • (GC) Fixed ISO8601 %date conversion pattern with a period '.' separator for milliseconds is now garbage free. (LOG4J2-1488)

  • (GC) Fixed %date conversion patterns with a timezone parameter are now garbage free. (LOG4J2-1489)

  • Log4j2 should postpone creating log file until the appender actually receives an event. (LOG4J2-1490)

  • Merging configurations failed with an NPE when comparing Nodes with different attributes. (LOG4J2-1500)

  • Fixed issue where CsvParameterLayout and CsvLogEventLayout inserted NUL characters if data starts with {, (, [ or " (LOG4J2-1502)

  • Log4j should not unregister JMX MBeans when log4j2.disable.jmx property is true. (LOG4J2-1506)

  • DynamicThresholdFilter filtered incorrectly when params were passed as individual arguments instead of varargs. (LOG4J2-1511)

  • Prevent deadlock in Async Loggers when queue is full and logged Object’s toString() logs another message. (LOG4J2-1518)

  • Added support for setting StatusLogger destination in ConfigurationBuilder. (LOG4J2-1526)

  • Prevent NPE in RingBufferLogEvent.getFormattedMessage() when used in web applications. (LOG4J2-1527)

  • Attributes were not merged properly in composite configurations. (LOG4J2-1529)

  • Fixed issue where LogEvent.getContextStack() returned null. (LOG4J2-1530)

  • Attributes were not merged properly in composite configurations. (LOG4J2-1532)

  • Prevent NPE when dynamically removing filters. (LOG4J2-1538)

  • Fix file handle resource leak in XmlConfiguration.XmlConfiguration(ConfigurationSource). (LOG4J2-1541)

  • Prevent ArrayIndexOutOfBoundsException in ParameterizedMessage.formatTo for single-char or empty messages. (LOG4J2-1542)

  • [CronTriggeringPolicy] ConfigurationScheduler scheduled the task infinitely after first fire. (LOG4J2-1548)

  • Fixed issue where AsyncLoggerContextSelector+PropertiesConfigurationBuilder defaulted to includeLocation=true. (LOG4J2-1549)

  • Prevent NPE in Level.isInRange. (LOG4J2-1559)

  • Prevent SocketAppender memory usage from growing unbounded if it cannot connect to a server. (LOG4J2-1562)

  • Fix to prevent Log4j 2.6.2 and higher from losing exceptions when a security manager is present. (LOG4J2-1563)

  • Layout is no longer optional. (LOG4J2-1573)

  • (GC) LoggerConfig now stores configuration properties in a List, not a Map to prevent creating temporary Iterator objects. Added method LoggerConfig#getPropertyList(), deprecated method #getProperties(). (LOG4J2-1575)

  • Unregistering JMX components no longer prints a stack trace when the MBean has already been unregistered. (LOG4J2-1581)

  • When initializing on platforms where JMX is not available, Interpolator component no longer prints stack trace for warning messages. (LOG4J2-1582)

  • Fixed scrambled log messages triggered by nested logging from toString() method of a logging parameter object. (LOG4J2-1583)

  • Fixed issue with filters extending AbstractFilter that did not override methods with unrolled varargs. (LOG4J2-1590)

  • Introduced new interface LifeCycle2 with stop(long,TimeUnit) method to avoid breaking backwards compatibility with new Configurator.shutdown(LoggerContext, long, TimeUnit) API. (LOG4J2-1591)

  • Prevent potential NPE in org.apache.logging.log4j.message.ParameterFormatter.formatMessage3(StringBuilder, char[], int, Object[], int, int[]). (LOG4J2-1599)

  • Prevent potential NPE due to org.apache.logging.log4j.core.layout.MarkerPatternSelector.createSelector(PatternMatch[], String, boolean, boolean, Configuration). (LOG4J2-1600)

  • Prevent potential NPE due to org.apache.logging.log4j.core.layout.ScriptPatternSelector.createSelector(AbstractScript, PatternMatch[], String, boolean, boolean, Configuration). (LOG4J2-1601)

  • Prevent potential NPE in org.apache.logging.log4j.core.util.datetime.FormatCache.MultipartKey.equals(Object) when object is null. (LOG4J2-1602)

  • Redo hashCode() and equals() methods in org.apache.logging.log4j.core.net.ssl classes. (LOG4J2-1603)

  • ServletAppender does not provide throwable object to ServletContext. (LOG4J2-1608)

  • Add targetNamespace to log4j-config.xsd. GitHub #43. (LOG4J2-1610)

  • Improved performance of context data injector for web applications to be on par with standalone applications. (LOG4J2-1611)

  • Fixed ClassCastException when using JUL logging during shutdown. (LOG4J2-1618)

  • new Log4jLogEvent().toString() throws an NPE. (LOG4J2-1619)

  • 2.7-rc1: RollingFileAppender immediateFlush default value should be true, not false. (LOG4J2-1620)

  • [OSGi] Fixed wrong Fragment-Host in manifest files. (LOG4J2-351)

  • Added ability to disable (date) lookup completely for compatibility with other libraries like Camel. (LOG4J2-905)

2.6.2

Release date

2016-07-05

This is the twelfth GA release. It is primarily a bugfix release. More details on the fixes are itemized below.

Note that subsequent to the 2.6 release a minor source incompatibility was found due to the addition of new methods to the Logger interface. If you have code that does:

logger.error(null, “This is the log message”, throwable);

or similar with any log level you will get a compiler error saying the reference is ambiguous. To correct this either do:

logger.error(“This is the log message”, throwable);

or

logger.error((Marker) null, “This is the log message”, throwable);

Log4j 2.6.2 maintains binary compatibility with previous releases.

Log4j 2.6.2 requires a minimum of Java 7 to build and run. Log4j 2.3 was the last release that supported Java 6.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Add "direct" option to ConsoleAppender for increased performance. (LOG4J2-1395)

  • Unbox utility’s ringbuffer of StringBuilders is now configurable. (LOG4J2-1412)

  • (GC) ParameterFormatter now avoids calling toString() on auto-boxed primitive message parameters. (LOG4J2-1415)

  • (GC) ObjectMessage and ReusableObjectMessage now avoid calling toString() on auto-boxed primitive parameters. (LOG4J2-1437)

Changed

Fixed

  • CronTriggeringPolicy was not properly setting the prevFileTime value for the PatternProcessor so file dates and times on rolled files were incorrect. (LOG4J2-1250)

  • Fixed minor issues with the 2.6.1 website. (LOG4J2-1414)

  • Fixed issue where Unbox utility ignored the value Constants.ENABLE_THREADLOCALS and always stored non-JDK classes in ThreadLocals. (LOG4J2-1417)

  • Provide MessageFactory2 to custom Logger implementations. (LOG4J2-1418)

  • RollingRandomAccessFileManager was not properly rolling over on startup and was getting a NullPointerException. (LOG4J2-1420)

  • Fixed issue where AsyncAppenderQueueFullPolicyTest sometimes hangs. (LOG4J2-1422)

  • Ensure that the thread-local StringBuilders used by Layouts to format log events to text will not retain excessive memory after a large message was logged. (LOG4J2-1434)

  • Fix bug in OnStartupTriggeringPolicy that allowed it to roll over on every reconfiguration. Added minSize attribute. (LOG4J2-1440)

  • OnStartupTriggeringPolicyTest fails on Windows saying the file is used by another process. (LOG4J2-1445)

  • Fixed issue where reusable messages broke flow tracing logic. (LOG4J2-1452)

  • If copy and delete fails in rename action then resort to truncating the source file after copying it. (LOG4J2-904)

2.6.1

Release date

2016-06-05

This is the eleventh GA release. It is primarily a bugfix release. More details on the fixes are itemized below.

Note that subsequent to the 2.6 release a minor source incompatibility was found due to the addition of new methods to the Logger interface. If you have code that does:

logger.error(null, “This is the log message”, throwable);

or similar with any log level you will get a compiler error saying the reference is ambiguous. To correct this either do:

logger.error(“This is the log message”, throwable);

or

logger.error((Marker) null, “This is the log message”, throwable);

Log4j 2.6.1 maintains binary compatibility with previous releases.

Log4j 2.6.1 requires a minimum of Java 7 to build and run. Log4j 2.3 was the last release that supported Java 6.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Added documentation about plugin builders compared to factories. (LOG4J2-1411)

Changed

  • (GC) CSV layouts should not create a new CSVPrinter for each log event. Requires Apache Commons CSV 1.4. (LOG4J2-1385)

  • Update liquibase-core from 3.4.2 to 3.5.1. (LOG4J2-1398)

  • Update Apache Commons CSV from 1.3 to 1.4. (LOG4J2-1399)

Fixed

  • Changed RenameAction to use java.nio to better report rename failures. (LOG4J2-1032)

  • Logger cache now accounts for message factory. (LOG4J2-1180)

  • Fixed minor issues with the 2.6 website. (LOG4J2-1394)

  • Fix regression in properties configuration to support arbitrary component ids. (LOG4J2-1402)

  • OnStartupTriggeringPolicy was forcing a rollover of empty files at startup and would append a second footer that was added by the prior shutdown. (LOG4J2-1405)

  • Fixed bug in ReusableParameterizedMessage where Throwable was never updated so first error was logged over and over again and subsequent errors were not logged. (LOG4J2-1406)

  • Fixed misleading WARN log events from Log4j about message factories and unexpected formatting. (LOG4J2-1407)

  • Added the module log4j-liquibase to BOM POM. (LOG4J2-1408)

  • Fixed ArrayIndexOutOfBoundsException that may occur in ReusableParameterizedMessage. (LOG4J2-1409)

  • Add filter and remove filter were not working properly in AbstractFilterable. (LOG4J2-997)

2.6

Release date

2016-05-25

This is the tenth GA release. It contains several bugfixes and new features. The new features include the ability to be garbage-free (avoid allocating temporary objects) while logging if certain conditions are met, a new YAML Layout, the ability to merge configuration files, and documenting Log4j’s performance against other logging frameworks and in various logging configurations. More details on the features and bugfixes are itemized below.

Note that subsequent to the release a minor source incompatibility was found due to the addition of new methods to the Logger interface. If you have code that does:

logger.error(null, “This is the log message”, throwable);

or similar with any log level you will get a compiler error saying the reference is ambiguous. To correct this either do:

logger.error(“This is the log message”, throwable);

or

logger.error((Marker) null, “This is the log message”, throwable);

Log4j 2.6 maintains binary compatibility with previous releases.

Log4j 2.6 requires a minimum of Java 7 to build and run. Log4j 2.3 was the last release that supported Java 6.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Document dependencies for layouts. (LOG4J2-1011)

  • Added option to discard events below a certain log level if the async logger ring buffer or async appender queue is full. (LOG4J2-1080)

  • Add JNDI lookup documentation. (LOG4J2-1133)

  • PatternLayout: Possible variable substitution in equals substitution parameter. (LOG4J2-1169)

  • Documented benchmark results comparing Log4j 2 performance to other logging libraries. (LOG4J2-1179)

  • Dynamic Subject for SMTP Appender. (LOG4J2-1192)

  • PatternLayout option to limit length of text. (LOG4J2-1217)

  • Added async logger Timeout wait strategy and made this the default wait strategy for async loggers. This prevents a rare deadlock that may occur on Solaris. (LOG4J2-1221)

  • Make PatternLayout header and footer accept a pattern. (LOG4J2-1237)

  • Make header and footer values customizable in JSONLayout. (LOG4J2-1244)

  • Make CSV Layout header and footers accept patterns. (LOG4J2-1245)

  • Add shutdown methods to LogManager. (LOG4J2-124)

  • JeroMqAppender should support layouts. (LOG4J2-1252)

  • (GC) Added support for garbage-free logging in steady state. This includes Async Loggers and logging synchronously to the console and to a file, but does not include the AsyncAppender. This release makes the GelfLayout and the main patterns in the PatternLayout garbage-free. (LOG4J2-1270)

  • (GC) Add MessageFactory that avoid allocation by reusing a cached ParameterizedMessage instance. (LOG4J2-1271)

  • (GC) Add encode(LogEvent, ByteBufferDestination) method to Layout API to enable converting LogEvents to bytes without creating temporary objects. (LOG4J2-1274)

  • FormattedMessage, MessageFormatMessage and StringFormattedMessage should support passing in a Locale to ensure appropriate formatting. (LOG4J2-1277)

  • (GC) Added unrolled varargs methods to Logger API, added Unbox utility to avoid auto-boxing when logging primitive values. (LOG4J2-1278)

  • (GC) Add interface StringBuilderFormattable to enable converting Messages and parameters to text without allocating temporary objects. ParameterizedMessage, ObjectMessage, SimpleMessage and ThreadDumpMessage now implement StringBuilderFormattable. (LOG4J2-1293)

  • (GC) Added manual page on garbage-free logging. (LOG4J2-1297)

  • Add pattern converter for thread id and priority in PatternLayout. (LOG4J2-1299)

  • Add documentation links to runtime dependencies in each component intro page. (LOG4J2-1303)

  • (GC) Added methods to the Logger interface for logging CharSequence messages. (LOG4J2-1326)

  • (GC) FileAppender, RollingFileAppender and MemoryMappedFileAppender are now also garbage-free by default. (LOG4J2-1344)

  • Add an AutoCloseable ThreadContext class: CloseableThreadContext. (LOG4J2-1348)

  • Option to not log stack traces for logged Throwables in GelfLayout. (LOG4J2-1357)

  • Added a YAML layout. (LOG4J2-1362)

  • (GC) Update Logger wrapper Generator tool to generate methods for the new Logger methods. (LOG4J2-1373)

  • Support merging configurations to for a composite configuration. (LOG4J2-494)

  • Pattern to drop first N package parts. (LOG4J2-621)

Changed

  • org.apache.logging.log4j.core.LoggerContext#updateLoggers should call firePropertyChangeEvent. (LOG4J2-1206)

  • Update SLF4J from 1.7.12 to 1.7.13. (LOG4J2-1219)

  • Misleading Value In Properties Example. (LOG4J2-1233)

  • Update Jackson from 2.6.3 to 2.6.4. (LOG4J2-1239)

  • Update Liquibase from 3.3.5 to 3.4.2. (LOG4J2-1240)

  • Update Jackson from 2.6.4 to 2.7.0. (LOG4J2-1249)

  • Update LMAX Disruptor from 3.3.2 to 3.3.4. (LOG4J2-1253)

  • Add enhanced entry and exit methods. (LOG4J2-1255)

  • (GC) ParameterizedMessage optimizations to avoid or at least postpone allocating temporary objects. (LOG4J2-1271)

  • (GC) Improve LoggerConfig’s data structure for AppenderControl objects to avoid allocating temporary objects during traversal for each log event. (LOG4J2-1272)

  • (GC) Provide ThreadLocal-based gc-free caching mechanism in DatePatternConverter for non-webapps. (LOG4J2-1283)

  • (GC) Update PatternLayout to utilize gc-free mechanism for LogEvent processing. (LOG4J2-1291)

  • (GC) Update RandomAccessFileAppender and RollingRandomAccessFileAppender to utilize gc-free Layout.encode() method. (LOG4J2-1292)

  • Update Kafka client from 0.9.0.0 to 0.9.0.1. (LOG4J2-1294)

  • Remove serializability from classes that don’t need it. (LOG4J2-1300)

  • Update Jackson from 2.7.0 to 2.7.2. (LOG4J2-1304)

  • JeroMqAppender should use ShutdownCallbackRegistry instead of runtime hooks. (LOG4J2-1306)

  • Remove need to pre-specify appender et al. identifiers in property file config format. (LOG4J2-1308)

  • (GC) Avoid allocating unnecessary temporary objects in LoggerContext’s getLogger methods. (LOG4J2-1318)

  • (GC) Avoid allocating unnecessary temporary objects in PatternLayout’s NamePatternConverter and ClassNamePatternConverter. (LOG4J2-1321)

  • Update Log4j 1.x migration guide to include information about system property lookup syntax changes. (LOG4J2-1322)

  • (GC) Avoid allocating unnecessary temporary objects in MarkerManager’s getMarker methods. (LOG4J2-1333)

  • (GC) ConsoleAppender is now garbage-free by default. This logic is reusable for all AbstractOutputStreamAppender subclasses. (LOG4J2-1343)

  • (Doc) Clarify documentation for properties that control Log4j behaviour. (LOG4J2-1345)

  • Update Jackson from 2.7.2 to 2.7.3. (LOG4J2-1351)

  • Update javax.mail from 1.5.4 to 1.5.5. (LOG4J2-1352)

  • (GC) GelfLayout does now support garbage-free logging (with compressionType=OFF). (LOG4J2-1356)

  • Update Apache Commons Compress from 1.10 to 1.11. (LOG4J2-1358)

  • (Log4j-internal) Provide message text as CharSequence for some message types to optimize some layouts. (LOG4J2-1365)

  • Migrate tests from Logback 1.1.3 to 1.1.7. (LOG4J2-1374)

  • Update SLF4J from 1.7.13 to 1.7.21. (LOG4J2-1375)

  • Update Jackson from 2.7.3 to 2.7.4. (LOG4J2-1380)

  • Update Apache Commons CSV from 1.2 to 1.3. (LOG4J2-1384)

  • Update Google java-allocation-instrumenter from 3.0 to 3.0.1. (LOG4J2-1388)

Fixed

  • Add a Log4jLookup class to help write log files relative to log4j2.xml. (LOG4J2-1050)

  • Fix documentation to specify the correct default wait strategy used by async loggers. (LOG4J2-1212)

  • Documentation/XSD inconsistencies. (LOG4J2-1215)

  • Creation of a LoggerContext will fail if shutdown is in progress. LogManager will default to SimpleLogger instead. (LOG4J2-1222)

  • NullPointerException in MapLookup.lookup if the event is null. (LOG4J2-1227)

  • Don’t concatenate SYSLOG Messages. (LOG4J2-1230)

  • Incorrect log rotation in last week of year. (LOG4J2-1232)

  • org.apache.logging.log4j.core.net.TcpSocketManager and other classes does not report internal exceptions to the status logger. (LOG4J2-1238)

  • Fixed broken nanotime in pattern layout. (LOG4J2-1248)

  • Fix JUL bridge issue where LogRecord.getParameters() is used when null. (LOG4J2-1251)

  • Fix typo in Flow Tracing documentation. (LOG4J2-1254)

  • Async DynamicThresholdFilter does not use the log event’s context map. (LOG4J2-1258)

  • TlsSyslogFrame calculates message length incorrectly. (LOG4J2-1260)

  • Stop throwing unnecessary exception in Log4jServletContextListener.contextDestroyed(). (LOG4J2-1262)

  • The ConfigurationSource was not saved for BuiltConfigurations so monitor interval had no effect. (LOG4J2-1263)

  • FixedDateFormat was incorrect for formats having MMM with the French locale. (LOG4J2-1268)

  • (GC) AsyncLogger should use thread-local translator by default. (LOG4J2-1269)

  • Fix RollingAppenderNoUnconditionalDeleteTest repeat test runs from failing. (LOG4J2-1275)

  • LoggerMessageSupplierTest and LoggerSupplierTest are Locale sensitive. (LOG4J2-1276)

  • Deprecate org.apache.logging.log4j.util.MessageSupplier. (LOG4J2-1280)

  • Logger methods taking Supplier parameters now correctly handle cases where the supplied value is a Message. (LOG4J2-1280)

  • (GC) LoggerConfig.getProperties() should not allocate on each call. (LOG4J2-1281)

  • Made default MessageFactory configurable. (LOG4J2-1284)

  • Change flow logging text from "entry' to "Enter" and "exit" to "Exit". (LOG4J2-1289)

  • Configuration file error does not show cause exception. (LOG4J2-1309)

  • JndiLookup mindlessly casts to String and should use String.valueOf(). (LOG4J2-1310)

  • Improve error handling in the Async Logger background thread: the new default exception handler no longer rethrows the error. (LOG4J2-1324)

  • Fix NoClassDefFoundError in ReflectionUtil on Google App Engine. (LOG4J2-1330)

  • LoggerFactory in 1.2 API module is not compatible with 1.2. (LOG4J2-1336)

  • (Perf) AsyncLogger performance optimization: avoid calling instanceof TimestampMessage in hot path. (LOG4J2-1339)

  • Exception from Log4jServletContextListener prevents jetty-maven-plugin run-forked. (LOG4J2-1346)

  • No configuration reload is triggered under Windows when replacing the configuration file with one that has older last modified date. (LOG4J2-1354)

  • Properties Configuration did not support includeLocation attribute on Loggers. (LOG4J2-1363)

  • (Log4j-internal) StatusLogger dropped exceptions when logging parameterized messages. (LOG4J2-1368)

  • "xz" compression results in plaintext, uncompressed files. (LOG4J2-1369)

  • XMLLayout indents, but not the first child tag (Event). (LOG4J2-1372)

  • Copying a MutableLogEvent using Log4jLogEvent.Builder should not unnecessarily obtain caller location information. (LOG4J2-1382)

  • Fixed memory leak related to shutdown hook. (LOG4J2-1387)

  • Log4jWebInitializerImpl: Use Thread instead of Class for fallback classloader. (LOG4J2-248)

  • Generate MDC properties as a JSON map in JSONLayout, with option to output as list of map entries. (LOG4J2-623)

  • JSONLayout doesn’t add a comma between log events. (LOG4J2-908)

  • ClassNotFoundException for BundleContextSelector when initialising in an OSGi environment. (LOG4J2-920)

2.5

Release date

2015-12-06

This is the ninth GA release. It contains several bugfixes and new features. The new features include the ability to specify delete actions during file rollover, a CRON-based triggering policy for file rollover, support for JSR 223 scripts in filters, pattern selectors and delete actions, and a policy for removing idle appenders from the RoutingAppender. More details on the features and bugfixes are itemized below.

Log4j 2.5 requires a minimum of Java 7 to build and run. Log4j 2.3 was the last release that supported Java 6.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Add support for JSR 223 scripts in filters and the PatternSelector. (LOG4J2-1136)

  • Add getters for source and destination file in file rename action. (LOG4J2-1168)

  • Add getters for classes in org.apache.logging.log4j.core.appender.rolling.action. (LOG4J2-1175)

  • Support use-case for JDBC’s CommonDataSource.setLogWriter(PrintWriter) and java.sql.DriverManager.setLogWriter(PrintWriter). (LOG4J2-1178)

  • Support use case for java.sql.DriverManager.setLogStream(PrintStream). (LOG4J2-1187)

  • Added support for custom delete actions triggered by a rollover. (LOG4J2-435)

  • Added system property to allow users to control whether messages should be formatted in the background. (LOG4J2-898)

  • Allow rollover to occur at any time. Add CronTriggeringPolicy. (LOG4J2-89)

Changed

  • Update Jackson from 2.6.2 to 2.6.3. (LOG4J2-1174)

  • Remove ConfigurationMonitor. The WatchManager is now used to check for configuration changes. (LOG4J2-1202)

  • Update kafka-clients from 0.8.2.2 to 0.9.0.0. (LOG4J2-1207)

  • Add PurgePolicy and IdlePurgePolicy to RoutingAppender. (LOG4J2-649)

Fixed

  • Performance improvement when gathering location information. (LOG4J2-1029)

  • Web site corrections and updates. (LOG4J2-1156)

  • Fix compilation error for classes annotated with @Plugin. (LOG4J2-1157)

  • Log4J JUL adapter is using MessageFormat on String passed by java.util.function.Supplier<String>. (LOG4J2-1158)

  • Fixed a ThreadLocal memory leak in Tomcat8 that mentions AsyncLoggers when Async Loggers are not used. (LOG4J2-1159)

  • Improve Log4j initialization status messages. (LOG4J2-1165)

  • AbstractConfiguration executor should use a DaemonThreadFactory. (LOG4J2-1166)

  • Use servlet context name for logger context name when available. (LOG4J2-1171)

  • Fixed ThreadLocal leak [AsyncLogger$Info] on Tomcat when using AsyncLoggerContextSelector. (LOG4J2-1172)

  • Fixed rollover error when copying to a directory mapped to a remote Linux host. (LOG4J2-1173)

  • Fixed memory leak when log4j jars are in Tomcat’s lib folder. (LOG4J2-1176)

  • Logger cache does not account for message factory. (LOG4J2-1180)

  • Prefix all thread names Log4j creates with "Log4j2-". (LOG4J2-1193)

  • Documentation does not match parameters for LoggerNameLevelRewritePolicy. (LOG4J2-1194)

  • Make KafkaAppender support SerializedLayout. (LOG4J2-1195)

  • MongoDbConnection does not close MongoClient. (LOG4J2-1196)

  • Better web app support for async loggers: Fixed a memory leak that occurred when the logging jars are placed in the container’s classpath and the configuration file uses AsyncRoot/AsyncLogger. The problem was that the first web application started the Disruptor background thread [AsyncLoggerConfig-1] but did not stop it until all web apps are stopped. Each web application now has its own Disruptor which is stopped/started together with the web app. (LOG4J2-323)

  • Reduced memory usage of status messages in bounded queue; support zero-length queue that stores no messages. (LOG4J2-324)

  • Allow triggering policy and rollover strategy to be modified during reconfiguration. (LOG4J2-381)

  • Better web app support for async loggers: it is now possible to place the logging jars in the container’s classpath when making all loggers asynchronous by using AsyncLoggerContextSelector. This fixes a problem where logging would stop working after stopping and restarting a web application. (LOG4J2-493)

  • org.apache.logging.log4j.core.Logger should be serializable. (LOG4J2-801)

  • Fixed bug where omitting the <display-name> element in web.xml caused incorrect log4j initialization, resulting in memory leaks when the web application was stopped or reloaded. (LOG4J2-873)

  • Documentation: fixed minor issues with the site and manual pages. (LOG4J2-879)

  • Fix plugin documentation error about Converters. (LOG4J2-948)

  • RollingFileAppender should also roll over when log event time is equal to rollover time, not only when later. (LOG4J2-999)

2.4.1

Release date

2015-10-08

This is the ninth GA release. It contains several bugfixes and new features. Log4j 2 requires a minimum of Java 7.

Apache Log4j 2.4.1 requires a minimum of Java 7 to build and run. Log4j 2.4 and greater requires Java 7, version 2.3 required Java 6.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Add possibility to set shutdown timeout on AsyncAppender. (LOG4J2-1020)

  • Allow PatternLayout to select a pattern to use based on some selection criteria. (LOG4J2-1129)

  • Add %equals to PatternLayout to test and replace patterns with strings. (LOG4J2-1145)

  • Add %notEmpty to PatternLayout to avoid output of patterns where all variables are empty. (LOG4J2-1146)

  • Add %equalsIgnoreCase to PatternLayout to test and replace patterns with strings. (LOG4J2-1147)

Changed

  • Update MongoDB driver from 2.13.3 to 3.0.4. (LOG4J2-1040)

  • Reuse StringBuilder to improve performance for String-based layouts: CSV, GELF, HTML, RFC524, Syslog. (LOG4J2-1128)

  • Update mongo-java-driver from 2.13.2 to 2.13.3. (LOG4J2-1131)

  • Do not use Jackson deprecated methods. (LOG4J2-1138)

  • Update Jackson from 2.6.1 to 2.6.2. (LOG4J2-1139)

  • Update kafka-clients from 0.8.2.1 to 0.8.2.2. (LOG4J2-1150)

  • Performance improvement: backport Java 8 fast ISO-8859-1 String to byte[] encoder to AbstractStringLayout. (LOG4J2-1151)

  • Performance improvement when converting Strings to byte[] arrays. (LOG4J2-935)

Fixed

  • Fixed Log4jLookup. (LOG4J2-1050)

  • Web site corrections and updates. (LOG4J2-1126)

  • log4j2.xml cannot be parsed on Oracle Weblogic 12c. (LOG4J2-1127)

  • Do not use MongoDB driver 2.13.3 deprecated methods. (LOG4J2-1132)

  • Compression on rollover was broken: log file was renamed to .zip but not compressed. (LOG4J2-1135)

  • Fixed bug where headers were not being written to first file with RollingFileAppender. (LOG4J2-1140)

  • Fix potential memory leak in web applications by using a straight ThreadLocal field instead of subclassing ThreadLocal. (LOG4J2-1142)

  • Add %markerSimpleName in pattern layout should evaluate to marker name (not toString()). (LOG4J2-1144)

  • Fixed bug where PatternLayout predefined date pattern with time zone always renders default date format. (LOG4J2-1149)

  • Fixed NullPointerException when only root logger is defined (and no named loggers) in configuration properties file. (LOG4J2-1153)

2.4

This is the eighth GA release. It contains several bugfixes and new features. As of this release Log4j now requires a minimum of Java 7.

Apache Log4j 2.4 requires a minimum of Java 7 to build and run. Log4j 2.4 and greater requires Java 7, version 2.3 required Java 6.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Add a way to route messages based on the %marker in Layout for RoutingAppender. (LOG4J2-1015)

  • New RewritePolicy for changing level of a log event. (LOG4J2-1023)

  • Add a Log4jLookup class to help write log files relative to log4j2.xml. (LOG4J2-1050)

  • Add API org.apache.logging.log4j.LogManager.getFormatterLogger(). (LOG4J2-1057)

  • Expose Log4jContextFactory’s ShutdownCallbackRegistry. (LOG4J2-1066)

  • Added support for system nanosecond time in pattern layout. (LOG4J2-1074)

  • Added support for compressing to bzip2 format on file rollover. (LOG4J2-1075)

  • Support additional Apache Commons Compress compression formats on rollover: Deflate, Pack200, XY. (LOG4J2-1077)

  • Add Comma Separated Value (CSV) layouts for parameter and event logging. (LOG4J2-1088)

  • Add Core Configurator APIs to change a logger’s level. (LOG4J2-1090)

  • Add API org.apache.logging.log4j.Level.isInRange(Level, Level). (LOG4J2-1105)

  • Add a LevelRangeFilter class. (LOG4J2-1106)

  • New Appender for Apache Kafka. (LOG4J2-1107)

  • New publisher Appender for ZeroMQ (using JeroMQ). (LOG4J2-1113)

  • Updated Logger wrapper generator tool to add Java 8 lambda support for custom log levels. (LOG4J2-1118)

  • Added support for Java 8 lambda expressions to lazily construct a log message only if the requested log level is enabled. (LOG4J2-599)

  • Add support for configuration via Properties. (LOG4J2-635)

  • New module for Liquibase integration. (LOG4J2-767)

  • Add ConfigurationBuilder for programmatic configuration. (LOG4J2-952)

Changed

  • Pass log event when interpolating logger properties. (LOG4J2-1010)

  • Update Java platform from Java 6 to 7. From this version onwards, log4j 2 requires Java 7. (LOG4J2-1017)

  • Update database tests from H2 1.3.175 to 1.3.176. (LOG4J2-1018)

  • Allow a list of keys to be specified in the MDC pattern converter. (LOG4J2-1022)

  • Log4j2 tries to SystemClassLoader when running on Google AppEngine. (LOG4J2-1035)

  • Update Apache Flume from 1.5.2 to 1.6.0. (LOG4J2-1036)

  • Update MongoDB driver from 2.11.2 to 2.13.2. (LOG4J2-1041)

  • Support batchSize in FlumeAvroManager. (LOG4J2-1044)

  • Avoid creating temporary array object in org.apache.logging.slf4j.Log4jMarker.iterator(). (LOG4J2-1063)

  • Define org.apache.logging.log4j.Marker.equals(Object) and org.apache.logging.log4j.Marker.hashCode(). (LOG4J2-1065)

  • Update Java Mail from 1.5.2 to 1.5.4. (LOG4J2-1070)

  • Update Jackson from 2.5.3 to 2.5.4. (LOG4J2-1079)

  • Update Jackson from 2.6.0 to 2.6.1. (LOG4J2-1092)

  • Improved performance of ParameterizedMessage::getFormattedMessage by ~2X. (LOG4J2-1096)

  • PatternLayout timestamp formatting performance improvement: predefined date formats (and variants using a period '.' millisecond separator instead of ',') are now formatted ~2-10X faster than other date formats. (LOG4J2-1097)

  • Update Apache Commons Compress from 1.9 to 1.10. (LOG4J2-1104)

  • Add thread name to status logger layout. (LOG4J2-1114)

  • LoggerConfig performance improvements: avoid unnecessary lock acquisition, use more efficient data structure. (LOG4J2-1120)

  • PatternLayout performance improvement by caching and reusing a ThreadLocal StringBuilder. (LOG4J2-1125)

  • Update Jackson from 2.5.4 to 2.6.0. (LOG4J2-1879)

  • MongoDB appender, username and password should be optional. (LOG4J2-403)

  • PatternLayout timestamp formatting performance improvement: replaced synchronized SimpleDateFormat with Apache Commons FastDateFormat. This and better caching resulted in a ~3-30X faster timestamp formatting. (LOG4J2-812)

  • log4j-web-2.1 should work around a bug in JBOSS EAP 6.2. (LOG4J2-890)

  • Fix FindBugs DM_DEFAULT_ENCODING bug in SimpleLogger.logMessage() and simplify code. (LOG4J2-959)

Fixed

  • ZipCompressAction leaves files open until GC when an IO error takes place. (LOG4J2-1019)

  • GzCompressAction leaves files open until GC when an IO error takes place. (LOG4J2-1020)

  • Custom java.util.logging.Level gives null Log4j Level and causes NPE. (LOG4J2-1025)

  • HighlightConverter does not obey noConsoleNoAnsi. (LOG4J2-1026)

  • SimpleLogger creates unnecessary Map objects by calling ThreadContext.getContext() instead of getImmutableContext(). (LOG4J2-1033)

  • Backward compatibility issue in log4j-1.2-api NDC pop() and peek(). (LOG4J2-1037)

  • Incorrect documentation for layout default charset. (LOG4J2-1038)

  • Socket and Syslog appenders don’t take timeout into account at startup. (LOG4J2-1042)

  • Write pending events to Flume when the appender is stopped. (LOG4J2-1044)

  • Externalize log4j2.xml via URL resource. (LOG4J2-1045)

  • Circular Exception cause throws StackOverflowError. (LOG4J2-1046)

  • FileConfigurationMonitor unnecessarily calls System.currentTimeMillis() causing high CPU usage. (LOG4J2-1048)

  • AsyncAppender now resets the thread interrupted flag after catching InterruptedException. (LOG4J2-1049)

  • NoClassDefFoundError when starting app on Google App Engine. (LOG4J2-1051)

  • Log4jMarker#contains(String) does not respect org.slf4j.Marker contract. (LOG4J2-1058)

  • Log4jMarker#contains(Marker) does not respect org.slf4j.Marker contract. (LOG4J2-1060)

  • Log4jMarker#remove(Marker) does not respect org.slf4j.Marker contract. (LOG4J2-1061)

  • Log4jMarker#add(Marker) does not respect org.slf4j.Marker contract. (LOG4J2-1062)

  • org.apache.logging.slf4j.Log4jMarker does not implement org.slf4j.Marker.equals(Object) org.slf4j.Marker.hashCode(). (LOG4J2-1064)

  • ThrowableProxy getExtendedStackTraceAsString throws NPE on deserialized nested exceptions. (LOG4J2-1067)

  • Exceptions not logged when using TcpSocketServer + SerializedLayout. (LOG4J2-1068)

  • Improper handling of JSON escape chars when deserializing JSON log events. (LOG4J2-1069)

  • GelfLayout throws exception if some log event fields are null. (LOG4J2-1078)

  • Misleading StatusLogger WARN event in LogManager with java.util.Map. (LOG4J2-1084)

  • NullPointerException when passing null to java.util.logging.Logger.setLevel(). (LOG4J2-1108)

  • org.apache.logging.log4j.jul.CoreLogger.setLevel() checks for security permission too late. (LOG4J2-1110)

  • OutputStreamManager in ConsoleAppender leaking managers. (LOG4J2-1117)

  • Fixed potential race condition on reconfiguration. Introduced ReliabilityStrategy to facilitate switching between different mechanisms for preventing log events from being dropped on reconfiguration. (LOG4J2-1121)

  • Core Configurator.initialize(String, ClassLoader, String) fails to work when config location is a file path. (LOG4J2-1123)

  • ExtendedThrowablePatternConverter does not print suppressed exceptions. (LOG4J2-684)

  • Header in layout should not be written on application startup if appending to an existing file. Fixes LOG4J2-1030. (LOG4J2-889)

  • Clarify documentation for combining async with sync loggers. (LOG4J2-918)

  • Circular suppressed Exception throws StackOverflowError. (LOG4J2-934)

  • Use System.nanoTime() to measure time intervals. (LOG4J2-982)

Removed

  • Removed experimental interface LevelLogger which got committed to master by mistake.

2.3

Release date

2015-05-09

This is the sixth GA release. It contains several bugfixes and new features.

Apache Log4j 2.3 requires a minimum of Java 6 to build and run. This will be the last release of Log4j 2 to support Java 6. Future releases will require a minimum of Java 7.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Truncate from the end of text format modifier. (LOG4J2-926)

  • PatternLayout %highlight to support noConsoleNoAnsi like %style. (LOG4J2-984)

Changed

  • Update Jackson from 2.5.1 to 2.5.3. (LOG4J2-1004)

  • Update Slf4j from 1.7.7 to 1.7.12. (LOG4J2-1005)

  • Migrate tests from Logback 1.1.2 to 1.1.3. (LOG4J2-987)

  • Update LMAX Disruptor from 3.3.0 to 3.3.2. (LOG4J2-988)

  • Update tests to use ActiveMQ from 5.10 to 5.11.1. (LOG4J2-988)

  • Move UTF-8 constant from Charsets to Constants class. Remove Charsets class. (LOG4J2-995)

  • Make org.apache.logging.log4j.core.Logger#updateConfiguration protected. (LOG4J2-998)

Fixed

  • JUL Logger.throwing is mis-mapped to ERROR when it should be TRACE. (LOG4J2-1003)

  • org.apache.logging.log4j.core.util#fileFromUri(URI uri) incorrectly converts '+' characters to spaces. (LOG4J2-1007)

  • org.apache.logging.log4j.core.config.plugins.util.ResolverUtil.extractPath(URL) incorrectly converts '+' characters to spaces. (LOG4J2-1008)

  • Incorrectly defined compressionType parameter to GelfLayout. (LOG4J2-1009)

  • A new StatusLoggerAdmin listener is added to StatusLogger every time the log is reconfigured. (LOG4J2-947)

  • StringFormattedMessage serialization is incorrect. (LOG4J2-964)

  • System.out no longer works after the Console appender and JANSI are initialized. (LOG4J2-965)

  • KeyStoreConfiguration.createKeyStoreConfiguration() ignores keyManagerFactoryAlgorithm. (LOG4J2-966)

  • log4j2.component.properties not read for all properties. (LOG4J2-967)

  • SyslogLayout contains extra space. (LOG4J2-968)

  • Another bad priority in Syslog messages. (LOG4J2-971)

  • org.apache.logging.log4j.core.net.ssl.TlsSyslogInputStreamReader does not need to create temp Integer objects. (LOG4J2-972)

  • Typo in EventLogger documentation. (LOG4J2-974)

  • Using monitorInterval with YAML config file format causes JSONParseException. (LOG4J2-976)

  • Numerical overflow in BurstFilter not handled correctly. (LOG4J2-980)

  • Incorrect unlock in ProviderUtil. (LOG4J2-981)

  • AbstractFilter should not implement equals() and hashCode(). (LOG4J2-985)

  • Async root logger config should default includeLocation to false. (LOG4J2-991)

  • Deadlock would occur if appender thread creates a new Logger during reconfiguration. (LOG4J2-993)

2.2

Release date

2015-02-22

This is the fifth GA release. It contains several bugfixes and new features.

Apache Log4j 2.2 requires a minimum of Java 6 to build and run. Future releases may require a minimum of Java 7.

Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Specify the SyslogAppender connect timeout value as part of the configuration. The SyslogAppender takes a new parameter connectTimeoutMillis. (LOG4J2-895)

  • Specify the SocketAppender connect timeout value as part of the configuration. The SyslogAppender takes a new parameter connectTimeoutMillis. (LOG4J2-899)

  • HTML layout should not use attribute minimalization for hr noshade. (LOG4J2-933)

  • Allow JSON layout to create one compact log record per line. (LOG4J2-941)

Changed

  • Update Jackson from 2.4.2 to 2.4.3. (LOG4J2-881)

  • Update maven-core from 3.1.0 to 3.2.3. (LOG4J2-882)

  • Update tests from org.apache.felix.framework 4.2.1 to 4.4.1. (LOG4J2-883)

  • Update org.eclipse.osgi from 3.6.0 to 3.7.1. (LOG4J2-884)

  • Update Apache Flume from 1.5.0.1 to 1.5.2. (LOG4J2-900)

  • Update docs for SyslogAppender: "No structured id name was supplied" (LOG4J2-901)

  • Update Jackson from 2.4.3 to 2.4.4. (LOG4J2-910)

  • Update from Jackson 2.4.4 to 2.5.0. (LOG4J2-925)

  • Incorrect attribute name in PropertiesRewritePolicy example. (LOG4J2-950)

  • Documentation: clarify system properties to control status logger, improve troubleshooting FAQ entry. (LOG4J2-955)

  • Update from Jackson 2.5.0 to 2.5.1. (LOG4J2-958)

Fixed

  • ThrowableProxy throws NoClassDefFoundError. (LOG4J2-834)

  • AbstractLifecycle should not implement equals() and hashCode(). (LOG4J2-881)

  • AbstractLifecycle should not implement equals() and hashCode(). (LOG4J2-891)

  • JUL adapter does not map Log4j'2 FATAL level to a JUL level. (LOG4J2-892)

  • NullPointerException on filter when mapping JUL to Log4j2. (LOG4J2-893)

  • Javadoc for org.apache.log4j.BasicConfigurator.configure() is incorrect. (LOG4J2-897)

  • ClassLoaderContextSelector uses ClassLoader.toString() as a key (LOG4J2-903)

  • XML configuration does not report full error message for XInclude parser configuration problems. (LOG4J2-912)

  • ThrowableProxy.getExtendedStackTraceAsString causes NullPointerException. (LOG4J2-914)

  • Logging system fails to initialize if XInclude API is not available. (LOG4J2-919)

  • Log4j 1.2 Bridge doesn’t map level ALL correctly in Category.getEffectiveLevel(). (LOG4J2-924)

  • ConsoleAppender is missing @PluginFactory annotation at createAppender method. (LOG4J2-931)

  • (JMX) To avoid memory leaks when web applications are restarted, JMX notifications are sent from the caller thread in web applications. For non-web applications notifications are sent from a background thread as before. (LOG4J2-938)

  • Log4j Flume appender is not adding millisecond to the event headers when the event is logged at 000 milliseconds. (LOG4J2-944)

  • [docs] Using Log4j 2 in Web Applications: Update example (Log4jWebLifeCycle is not visible). (LOG4J2-946)

  • Manual refers to Route "AppenderRef" attribute, should be "ref". (LOG4J2-956)

  • Missing toUpperCase(Locale.ENGLISH). (LOG4J2-957)

2.1

Release date

2014-10-19

This is the fourth GA release which contains several bugfixes and new features. There are two new Maven artifacts in this release: log4j-jul and log4j-iostreams. Both components are API-based with optional Core features.

Apache Log4j 2.1 requires a minimum of Java 6 to build and run. Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Implement a GELF layout. (LOG4J2-428)

  • Added Memory-Mapped File Appender. (LOG4J2-431)

  • Add the Log4j IOStreams component. (LOG4J2-547)

  • Supported filtering on custom log levels in configuration. (LOG4J2-589)

  • Add java.util.logging implementation based on log4j-api. See log4j-jul documentation for more details. (LOG4J2-608)

  • Add lookup for application main arguments. (LOG4J2-771)

  • Add lookup for JVM arguments. (LOG4J2-787)

  • Add support for custom SLF4J Markers in log4j-slf4j-impl module. (LOG4J2-793)

  • Move reflection utility class to API’s private utility classes. (LOG4J2-809)

  • Documentation: added section on XInclude to user manual Configuration page. (LOG4J2-816)

  • Add simple validation constraint annotations for the Plugin system. (LOG4J2-825)

  • Support use of TypeConverter classes through the standard Plugin system. (LOG4J2-827)

  • Documentation: added Runtime Dependencies link to left nav-bar on site. (LOG4J2-833)

  • Add a Java lookup to provide nicely formatted runtime version information. (LOG4J2-848)

  • Documentation: add sections on the JUL Adapter, IO Streams and NoSQL Appenders to the Maven and Ivy page. (LOG4J2-856)

  • Add ShutdownCallbackRegistry interface for customizable shutdown callback handling. This is particularly useful for application servers that wish to integrate with Log4j 2. (LOG4J2-868)

Changed

  • Incomplete documentation for JSONLayout. (LOG4J2-766)

  • Update Spring Framework to 3.2.11.RELEASE from 3.2.8.RELEASE. (LOG4J2-780)

  • Update Jackson to 2.4.2 from 2.4.1 (for XML and JSON processing). (LOG4J2-790)

  • All life cycle implementations should be serializable. This is still work in progress. (LOG4J2-800)

  • org.apache.logging.log4j.core.Logger should be serializable. This is still work in progress. (LOG4J2-801)

  • Update javax.mail to 1.5.2 from 1.5.0. (LOG4J2-810)

  • Unify the two JMS appenders into a single appender. Configurations written for 2.0 will still work in 2.1+. (LOG4J2-815)

  • Update org.eclipse.persistence.jpa to 2.5.2 from 2.5.1. (LOG4J2-822)

  • Documentation: updated FAQ "which jars" diagrams for JUL bridge and 2.1 version. (LOG4J2-831)

  • Update JMH to 1.1 from 0.7.2. (LOG4J2-844)

  • Add 2.1.0 to compatible versions in Log4j API ProviderUtil and update Log4jAPIVersion to 2.1.0 in core META-INF/log4j-provider.properties. (LOG4J2-845)

  • FlumeAppender: maxDelay not in seconds, but milliseconds. Add time scale to some settings, for example maxDelayMillis instead of maxDelay. The old names are aliased for compatibility. (LOG4J2-867)

Fixed

  • FlumePersistentManager now handles LockConflictExceptions in Berkeley Db when sending a batch. (LOG4J2-391)

  • Fix OSGi Import-Package problem with the JMS API. (LOG4J2-663)

  • Some typo fixes and enhancements for the site. (LOG4J2-676)

  • Documentation: fixed minor issues with Log4j2 website/documentation. (LOG4J2-678)

  • Avoid ConverterKey plugin clashes by using a more predictable plugin loading infrastructure. Plugins have been segmented into three parts: class path, user-specified packages, and OSGi bundles. (LOG4J2-745)

  • Reduced CachedClock thread contention. (LOG4J2-753)

  • Remove invalid Oracle Maven repository. (LOG4J2-782)

  • PatternLayout should use platform character encoding by default, not UTF-8. (LOG4J2-783)

  • Documentation: fixed capitalization inconsistency in user manual example config. (LOG4J2-785)

  • Fixed issue where log4j-to-slf4j did not work correctly with SLF4J Simple Logger. (LOG4J2-796)

  • Documentation: clarified why log4j-core is a compile-time dependency in Maven and Ivy page. (LOG4J2-797)

  • Fixed plugin scanning redundancy causing massive slowdowns in certain environments. (LOG4J2-798)

  • Prevent NPE when configuration with AsyncLogger/AsyncRoot is reloaded. (LOG4J2-807)

  • SimpleLogger throws ArrayIndexOutOfBoundsException for an empty array. (LOG4J2-811)

  • MarkerManager Log4jMarker.hasParents() returns opposite of correct result. (LOG4J2-813)

  • Fixed memory leak in Tomcat 6 caused by clock background threads unintentionally started by Tomcat after web application stop. (LOG4J2-819)

  • Fixed issue in RollingFile filePattern: backslashes are path separators, not escape characters. (LOG4J2-829)

  • Respect external interrupt signal to allow application shutdown after joining AsyncAppender thread. (LOG4J2-830)

  • ThrowableProxy fails if a class in logged stack trace throws java.lang.Error from initializer (LOG4J2-832)

  • Migrate JdbcH2AppenderTest JUnit performance test to log4j-perf. (LOG4J2-840)

  • Migrate JdbcHyperSqlAppenderTest JUnit performance test to log4j-perf. (LOG4J2-841)

  • Migrate JpaH2AppenderTest JUnit performance test to log4j-perf. (LOG4J2-842)

  • Migrate JpaHyperSqlAppenderTest JUnit performance test to log4j-perf. (LOG4J2-843)

  • Documentation: fix broken links on Appenders manual page. (LOG4J2-855)

  • Documentation: fix broken links on left navigation Extending Log4j Configuration sub-menu. (LOG4J2-861)

  • Fixed classloader issue that prevented Log4j from finding the implementation when used in a custom Ant task. (LOG4J2-862)

  • Documentation: fixed missing closing parenthesis in code example. (LOG4J2-866)

2.0.2

Release date

2014-08-16

This is the third GA release which contains several bugfixes from the previous release.

Apache Log4j 2.0.2 requires a minimum of Java 6 to build and run. Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Changed

  • Allow Log4jContextFactory subclasses to specify a custom ContextSelector. (LOG4J2-730)

  • Update Apache Flume to 1.5.0.1 from 1.5.0. (LOG4J2-775)

Fixed

  • Resolved race condition that caused log file rotation to fail with error: "Unable to create directory …​" (LOG4J2-679)

  • Clarified in documentation that Commons Logging jar is required when using log4j-jcl. (LOG4J2-722)

  • Clarified in documentation that SLF4J API jar is required when using log4j-slf4j-impl. (LOG4J2-723)

  • Prevent application from hanging when PatternLayout configuration has opening '{' but no closing '}'. (LOG4J2-726)

  • Emit warning message to console if no configuration file found. (LOG4J2-729)

  • Prevent JUnit test from creating unnecessary Log4j2Plugins.dat during build. (LOG4J2-756)

  • Fixed various minor site/documentation issues, mostly versioning related. (LOG4J2-759)

  • Documentation improvement: link to dependency tree from log4j-core component page, link to log4j-core component page from FAQ page. (LOG4J2-760)

  • Improved asynchronous loggers and appenders to ensure the formatted message does not change even if parameters are modified by the application. (ParameterizedMessage was already safe.) Improved documentation. (LOG4J2-763)

  • Improve warning message when missing log4j-core in the classpath. (LOG4J2-765)

  • Startup takes a long time if you have empty packages attribute. (LOG4J2-769)

  • Site: log4j-core component pages were still using the old logo. (LOG4J2-773)

2.0.1

Release date

2014-07-29

This is the first patch release of Log4j 2.0 which contains numerous bug fixes.

Apache Log4j 2.0.1 requires a minimum of Java 6 to build and run. Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Added documentation for Custom Levels and Custom Loggers. (LOG4J2-710)

  • Added WebLoggerContextUtils class to log4j-web for helper methods useful for asynchronous servlets. (LOG4J2-725)

Changed

  • Update to LMAX Disruptor 3.3.0 from 3.2.1. (LOG4J2-732)

  • Update to latest Jackson jars from the 2.4.1.X line. (LOG4J2-733)

Fixed

  • Fixed ClassLoader issues in loading Log4j providers in an OSGi environment. (LOG4J2-373)

  • Fixed AbstractDatabaseManager to close connection on writeInternal error. (LOG4J2-657)

  • DatePatternConverter ISO8601_PATTERN now conforms to ISO8601. (LOG4J2-670)

  • Android: Could not find class 'javax.naming.InitialContext', referenced from method org.apache.logging.log4j.core.lookup.JndiLookup.lookup. (LOG4J2-703)

  • Improved error message if configuration file not found. (LOG4J2-704)

  • Android: java.lang.VerifyError: org/apache/logging/log4j/core/util/Closer (LOG4J2-713)

  • Automatically disable log4j JMX when detecting we are running on Android. (LOG4J2-716)

  • Correctly handle NetworkOnMainThreadException thrown on Android during Log4j2 initialization. (LOG4J2-719)

  • Updated documentation regarding extensions to LoggerContextFactory and Log4j 2 providers. (LOG4J2-731)

  • Fixed log4j-bom so that it won’t interfere with spring-bom and others. (LOG4J2-735)

  • Fixed log4j-bom so that it won’t specify a default scope on any third party dependencies. (LOG4J2-736)

  • RollingFileManager deadlock if async action thread fails to start. (LOG4J2-738)

  • Fixed typo in webapp manual regarding sample web.xml file. (LOG4J2-740)

  • Reinstate the package configuration attribute for discovering custom plugins. (LOG4J2-741)

  • XInclude not working with relative path. (LOG4J2-742)

  • Avoid unnecessary Clock calls when TimestampMessage is logged. (LOG4J2-744)

  • Retain the default date pattern after fixing the ISO8601 pattern. (LOG4J2-749)

  • Webapp configuration page has incorrect class name. (LOG4J2-750)

2.0

Release date

2014-07-12

This is the first GA release, after thirteen prior releases over the last 4 years.

Apache Log4j 2.0 requires a minimum of Java 6 to build and run. Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the very implementation specific classes and methods. The package names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts with Log4j 1.x.

For complete information on Apache Log4j 2, including instructions on how to submit bug reports, patches, or suggestions for improvement, see the Apache Log4j 2 website.

Added

  • Added support for generating custom logger wrappers that replace the existing log levels and extended logger wrappers that add custom log levels to the existing ones. (LOG4J2-519)

  • RegexFilter does not match multiline log messages. (LOG4J2-696)

Changed

  • Make org.apache.logging.log4j.core.layout.AbstractLayout immutable. (LOG4J2-685)

  • Update Jackson to 2.4.1. (LOG4J2-689)

  • Update Apache Commons Logging to 1.2 from 1.1.3. (LOG4J2-709)

Fixed

  • LoggerConfigs with no Level now inherit the Level from their parent. (LOG4J2-441)

  • JMX GUI: fixed occasional ArrayIndexOutOfBoundsException after pressing "reconfigure with XML below". (Fixed in RC2, but wasn’t included in release notes.) (LOG4J2-538)

  • Fixed Serialization error with SocketAppender and Async Loggers. (Fixed in RC2, but wasn’t included in release notes.) (LOG4J2-625)

  • Update docs to clarify how to use formatter logger and standard logger together. (LOG4J2-631)

  • AsyncLoggerContextSelector should ensure that different AsyncLoggerContext objects created by web app classloaders have unique names. (LOG4J2-666)

  • Special characters (tab and so on) in PatternLayout do not work. (LOG4J2-682)

  • Fix annotation processor warnings on JDK 1.7+. (LOG4J2-683)

  • Core’s OptionConverter support for \b is broken (affects PatternLayout). (LOG4J2-686)

  • Rename org.apache.logging.log4j.core.util.Closer.closeSilent() to closeSilently(). (LOG4J2-687)

  • Make org.apache.logging.log4j.core.layout.PatternLayout immutable. (LOG4J2-688)

  • Log4j Web test dependencies should be in scope "test" in the pom. (LOG4J2-690)

  • Update documentation to specify only Maven 3 is supported. (LOG4J2-692)

  • Fix strange compilation error that popped up in a test class. (LOG4J2-694)

  • PatternLayout manual page missing documentation on header/footer. (LOG4J2-699)

  • Fixed issue where Async Logger does not log thread context stack data. API change: added method getImmutableStackOrNull() to ThreadContext.ContextStack interface. (LOG4J2-705)

  • Some exceptions are not logged when configuration problems are detected. (LOG4J2-707)

2.0-rc2

Release date

2014-06-21

Added

  • Add support for configuration via YAML. (LOG4J2-427)

  • Create an appender to route log events to the ServletContext log. (LOG4J2-42)

  • Add EncodingPatternConverter to escape newlines and HTML special characters. (LOG4J2-439)

  • Add org.apache.logging.log4j.Logger.getLevel(). (LOG4J2-576)

  • Introduce Java annotation processor as the new plugin pre-caching mechanism. This is available in log4j-core. All custom plugins created before this should be re-built against the current log4j-core. (LOG4J2-595)

  • Add support for types other than String for plugin factory values/attributes. (LOG4J2-598)

  • Document the system properties used in Log4J 2. (LOG4J2-629)

  • Implement a SecureSocketAppender and secure server (SSL/TLS). (LOG4J2-644)

  • Add support for default plugin values and attributes. (LOG4J2-652)

  • Add log4j-perf module to provide a home for all log4j performance tests. Add support for JMH microbenchmark performance tests. (LOG4J2-654)

  • Add Vagrantfile for testing in GNU+Linux. (LOG4J2-655)

  • Made RollingFileAppender buffer size configurable. (LOG4J2-674)

  • RollingFile and RollingRandomAccessFile now write the layout footer before rollover. (LOG4J2-675)

Changed

  • Refactor Log4jLogEvent to lazily create ThrowableProxy. (LOG4J2-250)

  • SLf4JLogger is now Serializable. (LOG4J2-410)

  • Support default value for missing key in look-ups with fallback to looking in the properties map. (LOG4J2-419)

  • Add support to add a LoggerConfig. Document two ways to modify the configuration. (LOG4J2-468)

  • Allow header and footer to be specified as lookup patterns in PatternLayout. (LOG4J2-496)

  • Have Logger API expose a PrintWriter instead of custom LoggerStream. (LOG4J2-547)

  • Allow configuration files to be located as Servlet Context resources. (LOG4J2-554)

  • Introduce ExtendedLogger interface to facilitate implementing and extending Loggers. (LOG4J2-555)

  • Allow spaces around commas in Configuration’s package attribute. (LOG4J2-561)

  • Made RollingRandomAccessFileAppender buffer size configurable. (LOG4J2-566)

  • Make Blocking the default WaitStrategy for Async Loggers. (LOG4J2-574)

  • Rename org.apache.logging.log4j.core.net.SocketServer to TCPSocketServer and refactor with UDP. (LOG4J2-582)

  • Add support for multiple parents to Markers. (LOG4J2-585)

  • Update Jackson to 2.3.2 from 2.2.2. (LOG4J2-592)

  • Update Jackson to 2.3.3. (LOG4J2-616)

  • Update SLF4J to 1.7.7. (LOG4J2-617)

  • Use Clock to generate all log event timestamps, not just for Async Loggers. (LOG4J2-628)

  • Override commons-logging dependency version in tests. (LOG4J2-641)

  • Merge the TLS Syslog appender into the Syslog appender. (LOG4J2-646)

  • Upgrade to Flume 1.5.0. (LOG4J2-647)

Fixed

  • Improved documentation regarding log4j status logger. (LOG4J2-141)

  • The log4j-1.2-api module didn’t export any packages to OSGi. (LOG4J2-345)

  • Cyclic dependency with log4j-slf4j-impl in OSGi. (LOG4J2-346)

  • Add DateLookup and ThreadContextLookup to default lookups. (LOG4J2-378)

  • Resolved a problem with the previous solution for LOG4J2-392 that resulted in dropped events when using AsyncLoggerConfig with slow appenders when application is stopped. (LOG4J2-392)

  • During shutdown, a NullPointerException could be thrown due to the NullConfiguration class no longer being available to the ClassLoader. (LOG4J2-440)

  • A StringIndexOutOfBounds exception could occur during property substitution. (LOG4J2-448)

  • FailoverAppender was not resetting its status after the primary appender recovered. (LOG4J2-469)

  • Add equals and hashcode to Log4jLogEvent. (LOG4J2-499)

  • Resolved issue where AsyncAppender dropped events if queue still contained events when application is stopped. (LOG4J2-520)

  • Reset rollover time when size rollover is triggered. (LOG4J2-535)

  • Fixed issue with "Reconfigure using XML below" function in JMX Client GUI. ConfigurationSource is now a top-level class and can be obtained with Configuration.getConfigurationSource(). LoggerContext.getConfiguration().getConfigurationSource() provides a reliable public method for obtaining a logger context’s configuration location and content. (LOG4J2-539)

  • Make Throwable transient in ThrowableProxy. (LOG4J2-542)

  • SyslogAppenderTest and RFC5424LayoutTest were failing in Java 8. (LOG4J2-560)

  • FlumeAvroManager now always uses a client type of default_failover. (LOG4J2-563)

  • Renamed SLF4J logger class to Log4jLogger. (LOG4J2-564)

  • Fix shutdown thread memory leak in servlet containers. (LOG4J2-570)

  • Rework Level comparison APIs. (LOG4J2-579)

  • RollingRandomAccessFile now writes the layout header after rollover. (LOG4J2-581)

  • StatusLogger was not skipping multiple instances of the FQCN class, causing messages from classes in the Verbose list to be printed. (LOG4J2-597)

  • Unit tests are now less verbose during the build process. (LOG4J2-602)

  • Password data from the NoSQL plugins no longer shows up in cleartext in debug logging. (LOG4J2-605)

  • The OSGi version of log4j-web imports Servlet 2.5 at minimum instead of 3.0. (LOG4J2-613)

  • Invalid XML configuration files do not prevent the config file from being checked again. (LOG4J2-619)

  • Perform reconfiguration in a separate thread to prevent deadlocks. (LOG4J2-620)

  • RollingFileManager now correctly honours the bufferedIO configuration after rollover. (LOG4J2-622)

  • Generate MDC properties as a JSON map in JSONLayout. (LOG4J2-623)

  • JMX: Updating a Logger’s level via jConsole now correctly takes effect. (LOG4J2-637)

  • Prevent NPE in AsyncLogger and AsyncLoggerConfig if logger is used after log4j has been shut down. (LOG4J2-639)

  • Fix NPE that can be caused by a null ThreadContextClassLoader. (LOG4J2-640)

  • Log4j 2 throws ArrayIndexOutOfBoundsException. (LOG4J2-651)

  • Moved plugin cache file to META-INF for OSGi compatibility. (LOG4J2-664)

  • Correctly process log events when combining AsyncLoggers with AsyncAppender. (LOG4J2-668)

  • Prevent NPE when combining AsyncLoggers with AsyncLoggerConfigs. (LOG4J2-669)

2.0-rc1

Release date

2014-02-16

Added

  • Configure FileAppender buffer size. (LOG4J2-401)

  • Configure RandomAccessFileAppender buffer size. (LOG4J2-402)

  • Format log event time as UNIX time (seconds or milliseconds). (LOG4J2-415)

  • Create a lookup for resource bundle substitution. (LOG4J2-420)

  • (JMX) Added MBeans for instrumenting AsyncAppenders and AsyncLogger RingBuffers, exposing queue size, remaining capacity and other attributes. (LOG4J2-423)

  • Added option to toggle Thread name caching in AsyncLogger. (LOG4J2-467)

  • ThreadContext now uses plain ThreadLocal by default, unless system property isThreadContextMapInheritable has value "true". (LOG4J2-479)

  • Add Stream interface to Loggers. (LOG4J2-481)

  • Documentation fix: The attribute of Route to refer to an appender is "ref" not "AppenderRef". (LOG4J2-482)

  • (JMX) JMX Client GUI should dynamically update when LoggerContext MBeans are registered/unregistered in MBean server. (LOG4J2-530)

Changed

  • PatternLayout option to not output ANSI escape codes if no Console is available. (LOG4J2-413)

  • Add support for custom logging levels. (LOG4J2-41)

  • Update Flume Appender to use Flume 1.4.0. (LOG4J2-453)

  • Update EasyMock to version 3.2. (LOG4J2-490)

  • Space Level numbers by 100 instead of 1. (LOG4J2-507)

  • Rename package org.apache.logging.log4j.core.appender.rolling.helper to org.apache.logging.log4j.core.appender.rolling.action. (LOG4J2-528)

  • Resource leak in Flume appender when it cannot create a BerkeleyDB db. (LOG4J2-532)

  • Renamed the org.apache.logging.log4j.core.appender.db.nosql.couch package to org.apache.logging.log4j.core.appender.db.nosql.couchdb.

Fixed

  • Resolved memory leak by releasing reference to ThreadLocal when AsyncLogger is stopped. (LOG4J2-323)

  • Changed the Servlet 3.0 auto-initializer to add the filter by class to get around a WebLogic bug. (LOG4J2-344)

  • (OSGi) logging.log4j-1.2-api doesn’t export the log4j API 1.2. Dependent bundles can not be resolved. (LOG4J2-345)

  • Changed the Servlet 3.0 auto-initializer so that it does nothing in a Servlet 2.5 or older application. This ensures behavioral consistency across containers. This includes additional fixes to abort initialization if a duplicate filter already exists and to check the actual Servlet EFFECTIVE version. (LOG4J2-359)

  • (OSGi) Fix NPE during shutdown. (LOG4J2-377)

  • Fixed issue that prevented Log4J from working in Google App Engine. (LOG4J2-379)

  • Fixed issues with time-based file rollover (monthly, weekly, hourly and every minute). (LOG4J2-385)

  • Stop AsyncLoggerConfig Disruptor thread(s), then AsyncAppender thread(s) first before stopping other appenders. (LOG4J2-392)

  • Configure properties and setup Interpolator before processing rest of configuration. (LOG4J2-398)

  • @EnterpriseNumber" was missing in the ID of structured data when RFC5424Layout is used (LOG4J2-404)

  • Configuration was being processed twice at startup. (LOG4J2-405)

  • (JMX) Unregister all log4j JMX MBeans when the LoggerContext is stopped to allow web application classes to be GC-ed on undeploy. (LOG4J2-406)

  • Fixed inability to recover from lost database connection in database appenders by connecting (borrowing from pool) on new write internal or on flush. (LOG4J2-407)

  • Fixed error in documentation code example in manual/eventlogging.html (LOG4J2-408)

  • Created a utility to properly escape backslashes before creating URIs, and changed URI creation to use the utility instead of instantiating URI directly. (LOG4J2-409)

  • Fix Event Level / LoggerConfig Level table at the architecture documentation page. (LOG4J2-417)

  • Resolved memory leak by populating AsyncLoggerConfigHelper ring buffer via EventTranslatorTwoArg, eliminating the need for a ThreadLocal. (LOG4J2-425)

  • Use the formatted Message in RFC5424Layout for non-StructuredDataMessages. (LOG4J2-430)

  • Ensured the JDBCAppender commits transactions after a single write or a flush of multiple writes. (LOG4J2-438)

  • Fixed problem with JDBC and JPA appender connectivity in WebSphere by connecting (borrowing from pool) on new write internal or on flush. (LOG4J2-442)

  • (JMX) Fixed issue where log4j2 LoggerContext did not show up in JMX GUI or JConsole. (LOG4J2-443)

  • ResolverUtil cannot find packages in file URLs which include the '+' character. (LOG4J2-445)

  • XMLLayout does not include marker name. (LOG4J2-447)

  • Fixed typo in documentation: system property should be log4j2.loggerContextFactory (LOG4J2-451)

  • Added a ServletContext attribute that, when set to "true", disables Log4j’s auto-initialization in Servlet 3.0+ web applications. (LOG4J2-452)

  • TimeBasedTriggeringPolicy should use event time millis. (LOG4J2-454)

  • RingBufferLogEvent should return Message timestamp for TimestampMessage messages. (LOG4J2-455)

  • Fixed failure of JDBC and JPA appender to properly release database connections by connecting (borrowing from pool) on new write internal or on flush. (LOG4J2-457)

  • Set external context when constructing the LoggerContext. (LOG4J2-459)

  • Fix LogEvent to never return null Level, fixes LevelPatternConverter.format may throw NPE. (LOG4J2-462)

  • Fixed documentation for MyApp example application in the Automatic Configuration section (LOG4J2-463)

  • Support arrays as sub-elements of a JSON configuration. (LOG4J2-464)

  • Fix LogEvent to never return null Level, fixes ThresholdFilter throws NPE. (LOG4J2-465)

  • Cannot load log4j2 config file if path contains plus '+' characters. (LOG4J2-466)

  • hostName property was not being set until after the first configuration element. (LOG4J2-470)

  • Fixed issue where toString methods that perform logging could deadlock AsyncLogger. (LOG4J2-471)

  • BaseConfiguration class does not properly implement Configuration interface. (LOG4J2-472)

  • Changed the MongoDBConnection to add a MongoDB encoding hook instead of a decoding hook. (LOG4J2-475)

  • NPE in ClassLoaderContextSelector. (LOG4J2-477)

  • The message and ndc fields are not JavaScript escaped in JSONLayout. (LOG4J2-478)

  • Fixed issue where toString methods that perform logging could deadlock AsyncAppender. (LOG4J2-485)

  • Fixed the JPAAppender’s overuse of transactions by connecting (borrowing from pool) on new write internal or on flush. (LOG4J2-489)

  • (JMX) Fixed MalformedObjectNameException if context name contains '=' or newline characters. (LOG4J2-492)

  • (JMX - ObjectNames changed!) Unloading one web application unloads JMX MBeans for all web applications. (LOG4J2-500)

  • Stop AsyncLoggerConfig Disruptor thread(s), then AsyncAppender thread(s) first before stopping other appenders. (LOG4J2-511)

  • Exposed Log4j web support interface and methods and the LoggerContext through ServletContext attributes so that threads not affected by filters (such as asynchronous threads) can utilize the LoggerContext. Also updated the Log4j filter so that it supports async. (LOG4J2-512)

  • Switch in log4j-1.2-api Category.getEffectiveLevel has no cases for FATAL, OFF. (LOG4J2-517)

  • LocalizedMessage serialization is broken. (LOG4J2-523)

  • Fixed bugs where rolled log files were overwritten by RollingFile appender with composite time and size based policies. (LOG4J2-531)

Removed

  • Removed the DataSourceConnectionSource and the <DriverManager> plugin for the JDBC Appender. It is not safe to use. Please use the DataSource or factory connection sources backed by a connection pool.

2.0-beta9

Release date

2013-09-14

Added

  • Added FAQ page to the site. (LOG4J2-253)

  • Ease porting from 1.x Logger.getRootLogger(): add LogManager.getRootLogger(). (LOG4J2-305)

  • Add JNDILookup plugin. (LOG4J2-313)

  • Add TLSAppender. Also added missing license headers to several files. (LOG4J2-338)

  • Enable XInclude for XML configurations. (LOG4J2-341)

  • Create a JSON Layout. (LOG4J2-356)

  • Allow Plugins to have aliases. (LOG4J2-360)

  • Add a diagram to the site (FAQ page) that explains when to use which jar. (LOG4J2-362)

  • Add WebLookup to retrieve information from the ServletContext. (LOG4J2-364)

  • Add more options to PatternLayout to display more detailed information about a Throwable. (LOG4J2-374)

  • [Pattern Layout] Customize level names by length. (LOG4J2-383)

  • [Pattern Layout] Customize level names to lower-case. (LOG4J2-384)

  • Allow the default file rollover strategy to define the compression level. (LOG4J2-399)

Changed

  • Changed the (relatively new) PatternLayout configuration attribute "suppressExceptions" to "alwaysWriteExceptions" to more correctly indicate what it does. As such, the meaning of this attribute has reversed (previous "true"s should become "false"s, and vice versa). Since this was an undocumented attribute up until now, it’s unlikely this change will affect any users.

  • Changed the "suppressExceptions" configuration attribute for all Appenders to "ignoreExceptions" to avoid confusion with Java 7 suppressed exceptions. Also renamed the Appender#isExceptionSuppressed() method to Appender#ignoreExceptions() to avoid the same confusion. All Appenders by default internally log and then ignore exceptions encountered while logging. Setting "ignoreExceptions" to "false" on an Appender causes it to allow exceptions to propagate to the caller. You must set "ignoreExceptions" to "false" for Appenders you are wrapping in the Failover Appender.

  • Cleaned up tests and cleared up documentation for the JPA appender following the resolution of EclipseLink issue #412454.

  • Improved site by adding quick jump-off page and menu for Javadoc links for all components.

  • Update JSON Jackson library to 2.2.2 from 2.2.1. (LOG4J2-306)

  • Updated Async Loggers' LMAX Disruptor library from 3.0.1 to 3.2.0. (LOG4J2-307)

  • Clarified which library versions were used in Async Loggers performance test. (LOG4J2-308)

  • XML layout improvements (compact vs. pretty, namespace, namespace prefix, root element). (LOG4J2-312)

  • Renamed FastFileAppender and FastRollingFileAppender to RandomAccessFileAppender and RollingRandomAccessFileAppender. Configurations using the Fast(Rolling)File element no longer work and should be modified to use the (Rolling)RandomAccessFile element. (LOG4J2-317)

  • Allow shutdown hook to be disabled in the configuration. (LOG4J2-318)

  • Update JDBC tests to use H2 database 1.3.173 from 1.3.172. (LOG4J2-325)

  • Add support for multiple SD-ELEMENTs in an RFC 5424 syslog message. (LOG4J2-355)

  • Update commons-logging to 1.1.3 from 1.1.1. (LOG4J2-366)

  • Update Jackson dependency to 1.9.13 from 1.9.11. (LOG4J2-387)

  • Update Java Mail dependency to 1.5.0 from 1.4.7. (LOG4J2-388)

  • Update HSQLDB dependency to 2.3.0 from 2.2.9. (LOG4J2-390)

Fixed

  • The slf4j-ext jar is now an optional dependency of the SLF4J bridge. (LOG4J2-165)

  • RoutingAppender’s default Route can now be an appender reference. (LOG4J2-166)

  • ThrowableProxy no longer extends Throwable. (LOG4J2-216)

  • Fix table of contents generation in pdf. (LOG4J2-226)

  • Additional fix to make AsyncAppender threads daemon threads and improve their thread name. (LOG4J2-280)

  • Fixed JDBC, JPA, and NoSQL appenders so that the failover appender properly fails over on error. (LOG4J2-291)

  • Changed the ConfigurationFactory to recognize and properly use the classpath: URI scheme in addition to the classloader: URI scheme. (LOG4J2-293)

  • Reset the Configuration if the ClassLoaderContextSelector creates a LoggerContext without a configuration location and then is later provided one. (LOG4J2-293)

  • Add getThrowable method to ThrowableProxy. (LOG4J2-299)

  • Fixed Async Loggers memory leak. (LOG4J2-304)

  • Insure jars and distributions only have a single License and Notice file. (LOG4J2-309)

  • Fixed issue where SMTPAppender did not send mails with error or fatal level without prior info event. (LOG4J2-310)

  • Synchronized flush() and close() methods in the XxxFileManager and OutputStreamManager classes. (LOG4J2-311)

  • Double stack trace logging when using %throwable in %style and %highlight. (LOG4J2-319)

  • JPAAppender stops logging because META-INF/log4j-provider.properties is left open. (LOG4J2-320)

  • Centralized reflective use of Reflection#getCallerClass and properly handled its instability in various versions of Java. (LOG4J2-322)

  • FlumePersistentManager was calling Berkeley DB’s count method too frequently. (LOG4J2-328)

  • StatusLogger now only creates StatusData objects if they are the appropriate logging level. (LOG4J2-329)

  • Added a BSON Transformer so that MongoDB can persist Log4j events. (LOG4J2-330)

  • Removed erroneous check for affected MongoDB records, which always returns zero on inserts. (LOG4J2-331)

  • Modified documentation to refer to SLF4J Binding instead of SLF4J Bridge. (LOG4J2-332)

  • Match artifact ids with Maven module names. (LOG4J2-333)

  • FlumePersistentManager’s writer thread had high CPU usage. (LOG4J2-335)

  • AsyncLogger errors after multiple calls to LoggerContext.reconfigure(). (LOG4J2-336)

  • Ignore xml:base attributes. (LOG4J2-342)

  • Removed unnecessary generics from Appender interface and implementing classes. (LOG4J2-343)

  • Give the AsyncAppender thread a more descriptive name for easier debugging/profiling. (LOG4J2-347)

  • [OSGi] wrong Fragment-Host in manifest files. (LOG4J2-351)

  • NoSQLAppender using MongoDB provider ignores username and password attributes (LOG4J2-358)

  • Changed the Servlet 3.0 auto-initializer so that it does nothing in a Servlet 2.5 or older application. This ensures behavioral consistency across containers. (LOG4J2-359)

  • JMS appenders send two messages for one append. (LOG4J2-367)

  • Add PatternLayout constructor to Log4j 1.2 bridge for Velocity. (LOG4J2-368)

  • Use rollover date when substituting ${date} in the filePattern. (LOG4J2-380)

  • FlumePersistentManager now handles LockConflictExceptions in Berkeley Db. (LOG4J2-391)

  • Initialize PluginManager once during configuration. Move advertisement setup into BaseConfiguration. (LOG4J2-393)

  • Allow classpath scheme when specifying configuration file location as a system property. (LOG4J2-395)

  • Logger.info(Message) Javadoc is incorrect. (LOG4J2-397)

2.0-beta8

Release date

2013-07-10

Changed

  • Include arbitrary message fields in RFC-5424 structured data. (LOG4J2-168)

  • Improved logging initialization in Servlet containers, especially Servlet 3.0 and newer where Log4j now initializes and deinitializes automatically with no deployment descriptor configuration. (LOG4J2-270)

  • Wasted work in XMLLayout.toSerializable(). (LOG4J2-273)

  • Wasted work in UUIDUtil initialization. (LOG4J2-274)

  • Wasted work in RollingAppenderSizeTest.testAppender() and others. (LOG4J2-277)

  • Allow the default status level to be specified as a system property. (LOG4J2-282)

  • Remove dependency on Apache ORO jar. (LOG4J2-283)

  • Update Log4j 1 dependency to 1.2.17 from 1.2.16. (LOG4J2-284)

  • Update Jansi jar to 1.11 from 1.9. (LOG4J2-285)

  • Update test H2 JDBC driver to 1.172 from 1.171. (LOG4J2-286)

  • Update JUnit to 4.11 from 4.7. (LOG4J2-288)

  • LogManager.getLogger can now be called without a logger name or with a null logger name. (LOG4J2-294)

  • Add printf methods to Logger API. (LOG4J2-301)

  • Update NoSQL dependencies: lightcouch 0.0.6 from 0.0.5, mongodb 2.11.2 from 2.11.1. (LOG4J2-386)

Fixed

  • Fix NullPointerException (regression due to fix for LOG4J2-228) (LOG4J2-139)

  • FastRollingFileAppender with TimeBasedTriggeringPolicy now works correctly if append=false. (LOG4J2-267)

  • FastRollingFileAppender with TimeBasedTriggeringPolicy now works correctly if append=false. (LOG4J2-271)

  • FlumeAvroManager fails to notify client of failing event if Flume RPCClient cannot be created. (LOG4J2-275)

  • Filter calls from Avro or Flume to be ignored by the FlumeAppender. (LOG4J2-278)

  • FlumePersistentManager now calls Berkeley DB from threads to avoid encountering interrupts in the application. (LOG4J2-279)

  • AsyncLogger threads are now daemon threads and won’t prevent the JVM from shutting down anymore. (LOG4J2-280)

  • Upgrade javadoc plugin to 2.9.1 to fix javadoc security issue. (LOG4J2-289)

  • Fast(Rolling)FileAppender now correctly appends to (does not overwrite) existing file. (LOG4J2-292)

  • Fast(Rolling)FileAppender now correctly handles messages exceeding the buffer size. (LOG4J2-295)

  • Wasted work in FlumePersistentManager.createManager. (LOG4J2-296)

  • Wasted work in TestConfigurator.testEnvironment. (LOG4J2-297)

  • Wasted work in StyleConverterTest.setupClass. (LOG4J2-298)

  • WriterThread was ending when no agents are available which caused an OutOfMemoryError. (LOG4J2-300)

  • Added toString methods to ThreadContextStack/Map implementation classes. (LOG4J2-302)

2.0-beta7

Release date

2013-06-01

Added

  • Break up core into multiple osgi jars. (LOG4J2-10)

  • New JDBC, JPA, and NoSQL database Appenders. (LOG4J2-229)

  • Provide configuration information (location, content type, content if possible) via a registered Advertiser. (LOG4J2-251)

Changed

  • Improve ThreadContext performance with copy-on-write map and stack. (LOG4J2-154)

  • Allow custom LogEventFactories. (LOG4J2-243)

  • Allow context parameters in Log4jContextListener to include properties. (LOG4J2-249)

  • Add support for interceptors in the embedded Flume Appender. (LOG4J2-262)

  • Method name changes in interface org.apache.logging.log4j.spi.ThreadContextMap: getContext() to getCopy(), get() to getImmutableMapOrNull().

Fixed

  • Remove LoggerContext when LoggerContext is stopped. (LOG4J2-223)

  • UDP now sends one event per packet. (LOG4J2-228)

  • StringFormattedMessage and MessageFormatMessage now will accept a Throwable as their last argument and pass it on. (LOG4J2-242)

  • Rewrite Appender was ignoring filters on referenced appenders. (LOG4J2-244)

  • Avoid EmptyStack exception if getCallerClass and SecurityManager are not available. (LOG4J2-245)

  • Data buffer is reset in finally clause. (LOG4J2-246)

  • SocketServer.isActive should be volatile because it is accessed from different threads. (LOG4J2-247)

  • Mark OutputStream in OutputStreamManager as volatile. Mark header and footer as final. (LOG4J2-254)

  • Multi-byte character strings are now assumed to be in the platform default encoding, not UTF-8. (LOG4J2-255)

  • XML layout ignores charset for the XML processing instruction’s encoding attribute. (LOG4J2-257)

  • HTML layout does not output meta element for charset. (LOG4J2-258)

  • HTML layout does not specify charset in content type. (LOG4J2-259)

  • XML layout does not specify charset in content type. (LOG4J2-260)

  • Add missing "not" to error message. (LOG4J2-261)

  • Do not allow a charset on RFC5424Layout - use UTF-8. (LOG4J2-263)

  • Add guid to FlumeEvent headers for non-Map Messages. (LOG4J2-268)

  • Use transaction when batch size is 1. (LOG4J2-269)

2.0-beta6

Release date

2013-05-05

Changed

  • Documentation updates to clarify use and impact of location in pattern layouts. (LOG4J2-225)

  • Improved error reporting when misconfigured. (LOG4J2-230)

  • Moved JMX Client GUI classes into separate jmx-gui submodule. (LOG4J2-237)

  • Moved Clock interface to package org.apache.logging.log4j.core.helpers.

  • Removed CheckStyle false positives for NewlineAtEndOfFile and whitespace following '*' at end of line in javadoc.

  • Renamed AsynchAppender to AsyncAppender. Plugin name became Async (was Asynch).

Fixed

  • Use OSGi version format in Fragment-Host (LOG4J2-159)

  • Add support for interpolating Environment variables when processing the configuration. (LOG4J2-192)

  • Renamed Plugin annotation attribute from "type" to "category". (LOG4J2-201)

  • Various small documentation fixes. (LOG4J2-215)

  • Ensure PluginManager streams are always closed. (LOG4J2-217)

  • Fix: install default root logger if not configured (this is unchanged), but make sure to include configured named loggers. Clarified documentation. (LOG4J2-219)

  • Remove hundreds of compiler warnings. (LOG4J2-221)

  • Disruptor will now shut down during Tomcat shutdown. (LOG4J2-222)

  • Fix LoggerContext start and stop to eliminate IllegalStateException and NoClassDefFound errors. (LOG4J2-223)

  • The FlumeAppender failed to start if the Flume RPCClient could not connect to any Flume agents. (LOG4J2-224)

  • Logger.getParent() was not returning the correct Logger. (LOG4J2-231)

  • Fixed link to log4j-user mailing list. (LOG4J2-233)

  • RegexFilter threw a NullPointerException when used as a context-wide filter. (LOG4J2-234)

  • Removed dependency on tools jar from core module, made jconsole dependency optional. (LOG4J2-235)

2.0-beta5

Release date

2013-04-20

Added

  • Added FlumePersistentManager which writes to BerkeleyDB and then writes to Flume asynchronously.

  • Expose file appender configuration details via an advertisement mechanism. (LOG4J2-155)

  • Add support for asynchronous loggers. (LOG4J2-163)

  • Add methods is/setEndOfBatch to LogEvent. (LOG4J2-164)

  • Add Logger interface APIs to log at given levels. (LOG4J2-179)

  • Add tag library. (LOG4J2-187)

  • Add JMX support. (LOG4J2-207)

Changed

  • Allow Logger and LoggerContext to be subclassed. (LOG4J2-151)

  • Added ability to include or exclude location information. (LOG4J2-153)

  • Allowed Loggers access to the properties in the LoggerConfig. (LOG4J2-157)

  • Add RFC 5424 compliant escaping rules to RFC5424Layout. (LOG4J2-158)

  • Move Throwable pattern converter options processing to ThrowableFormatOptions class. (LOG4J2-160)

  • Move async subproject into core. (LOG4J2-208)

  • Async documentation update. (LOG4J2-214)

Fixed

  • Add Fragment-Host to MANIFEST.MF for log4j-core. (LOG4J2-159)

  • Modify ClassLoaderContextSelector to use the first ClassLoader in the child parent hierarchy that has a Context with a configuration to allow JSPs to use the WebApp’s context and configuration. (LOG4J2-161)

  • Configurator throws a ClassCastException if LogManager returns a SimpleLoggerContext. (LOG4J2-167)

  • ConfigurationFactory was adding factories on every call. (LOG4J2-169)

  • Plugin cache should be reset when addPackages is called. (LOG4J2-175)

  • Avoid IllegalArgumentException in AsynchAppender. (LOG4J2-176)

  • Fix NullPointerException in DatagramOutputStream when flush is called from multiple threads. (LOG4J2-177)

  • OutputStreamManager now adds the layout header whenever the OutputStream is set. (LOG4J2-181)

  • AppenderRefs on AsynchAppender didn’t support the level and filter elements. (LOG4J2-188)

  • The blocking parameter did not work properly on AsynchAppender. (LOG4J2-189)

  • BaseConfiguration addLoggerAppender saved appender using the Logger name. (LOG4J2-190)

  • RollingFastFileAppender (in log4j-async) did not roll over. (LOG4J2-193)

  • ThrowableFormatOptionsTest failed on Windows due to CR/LF issue. (LOG4J2-194)

  • Unit tests now create files in the target directory. (LOG4J2-195)

  • FlumeAvroManager now uses Flume RPCClient. (LOG4J2-196)

  • FlumeAvroManager now uses Flume RPCClient. (LOG4J2-198)

  • Highlight subprojects in sub-navigation. (LOG4J2-199)

  • LoggerContext method renamed to removeFilter from removeFiler. (LOG4J2-200)

  • Fix deadlock in SocketAppender. Added option to not wait for socket reconnect. (LOG4J2-205)

  • Use the Maven group ID org.apache.logging.log4j for all artifacts. (LOG4J2-207)

  • MapMessage was not enclosing key value in quotes when generating XML. (LOG4J2-210)

  • Removing extra spaces in entry and exit method output. (LOG4J2-211)

  • Call LoggerContext.stop when the application is shutdown. (LOG4J2-212)

  • Loggers without a "." had no parent logger. (LOG4J2-212)

2.0-beta4

Release date

2013-01-28

Added

  • Add MessageFormatMessage and FormattedMessage.

  • Added Flume Appender samples.

  • Added Log4j 2 to SLF4J adapter.

  • Added hostName and contextName to property map.

  • Add SMTPAppender. (LOG4J2-131)

  • Allow custom message creation via a message factory. (LOG4J2-133)

  • Use %red, %white, %blue, and so on in the console appender. (LOG4J2-134)

Changed

  • Renamed log4j12-api to log4j-1.2-api. (LOG4J2-110)

  • Add unit test to verify exceptions are thrown when the socket connection fails. (LOG4J2-122)

  • Add follow attribute to Console Appender. (LOG4J2-128)

  • Allow newlines to be escaped in Syslog and RFC5424 layouts. Allow Throwables to be included in the output from RFC5424Layout. (LOG4J2-136)

Fixed

  • Allow FlumeAvroManager to initialize even if it cannot connect to an agent.

  • Enhanced javadoc copyright statement. (LOG4J2-111)

  • StructuredDataFilter createFilter was annotated with PluginAttr instead of PluginElement for the KeyValuePairs. (LOG4J2-113)

  • StructuredDataMessage was validating the length of the values in the event Map instead of the lengths of the keys. (LOG4J2-114)

  • ThreadContext Map elements with null values are now ignored when constructing a Flume event and in the RFC5424 Layout. (LOG4J2-115)

  • File renaming was using the wrong date value. Enhanced DefaultRolloverStrategy to store newest files in highest index as well as lowest. (LOG4J2-116)

  • A broken socket connection would cause the TCPSocketManager to continuously reconnect. (LOG4J2-119)

  • TCPSocketManager would fail if the initial connection could not be established. (LOG4J2-120)

  • The example for ThreadContextMapFilter was incorrect. (LOG4J2-123)

  • JMSQueue and JMSTopic Appenders did not allow name to be specified. (LOG4J2-125)

  • Allow JMS appenders to recover if the queue or topic is unavailable. (LOG4J2-126)

  • AbstractLogger methods were not passing Markers to the isEnabled methods. (LOG4J2-127)

  • RoutingAppender was only creating a single appender for the default Route. (LOG4J2-129)

  • PatternLayout should format throwables without requiring a converter. (LOG4J2-130)

  • AbstractLogger.catching(Throwable) checks for DEBUG level but logs at ERROR level. (LOG4J2-132)

  • BaseConfiguration does not close the first appender. (LOG4J2-135)

  • Fix hang in Dumbster SMTP test server. (LOG4J2-137)

  • Fix null pointer exception in SocketAppender if no protocol is specified. The protocol will default to TCP for the SocketAppender and UDP for the SyslogAppender. (LOG4J2-139)

  • Typo in documentation of SocketAppender. (LOG4J2-140)

  • Serialized LogEvents were not reset in the output stream causing them to deserialize incorrectly. (LOG4J2-142)

  • MessagePatternConverter now returns "null" if the log message is null. (LOG4J2-143)

  • NullPointerException in RFC5424Layout. (LOG4J2-144)

  • Add missing serial version IDs. (LOG4J2-145)

  • ThreadContextMapFilter was matching on the key instead of the value of the key. (LOG4J2-147)

  • SMTPAppender will only cache filtered events. (LOG4J2-149)

  • Convert all System.getProperty calls to use PropertiesUtil to suppress SecurityExceptions. (LOG4J2-150)

  • RollingFileAppender’s FileRenameAction was throwing a NullPointerException if no directory was specified on the target file name. (LOG4J2-152)

  • LocalizedMessageTest fails on linux system. (LOG4J2-156)

2.0-beta3

Release date

2012-11-11

Added

  • Added PropertiesRewritePolicy and ability to define properties on a Logger. (LOG4J2-28)

  • Added ability to configure from an InputSource. (LOG4J2-55)

Changed

  • Created combined jar to combine API and Core contents for users who only want the Log4j implementation.

  • Add ability to customize the names of the Levels in the LevelPatternConverter. (LOG4J2-105)

  • Added font and fontSize parameters to HTMLLayout. Replace newlines in message with br tag. (LOG4J2-29)

  • Add ThreadContext.push(String format, Object…​ args) (LOG4J2-85)

  • Build pdf of user’s guide. (LOG4J2-87)

Fixed

  • Avoid NPE when duplicate LoggerContextFactorys are present. Allow factories to specify a weight to allow real implementations to outrank test implementations. Provide a simple default LoggerContextFactory.

  • A NullPointerException would occur if no format value was passed to the SyslogAppender. (LOG4J2-101)

  • The Facility value was being improperly calculated. (LOG4J2-102)

  • The LogEvent was wrapping a ThrowableProxy with another ThrowableProxy when deserializing. (LOG4J2-103)

  • Convert LogManager binding to use "regular" java properties instead of XML properties to work around a bug in Oracle’s xmlparserv2 jar. (LOG4J2-104)

  • PatternParser was not properly handling adjacent nested options (LOG4J2-107)

  • Fix NullPointerException in ClassLoaderContextSelector when no class is returned from the SecurityManager. (LOG4J2-108)

  • Interpolator was not stripping Lookup key separator when trying to locate the default value for a variable. (LOG4J2-94)

  • Add support for loading plugins inside the OSGi bundle. (LOG4J2-95)

  • Added several missing classes and methods for Log4j 1.x compatibility. (LOG4J2-97)

  • MapRewritePolicy had an extra call to putAll that caused updates to behave like adds. (LOG4J2-99)

  • Log4j 1.2 Category.forcedLog was wrapping the message with an ObjectMessage even if the parameter was an ObjectMessage.

2.0-beta2

Release date

2012-10-07

Added

  • Add getFormats to MultiformatMessage and allow StructuredDataMessage to format as XML.

  • Add support for ANSI colors by adding the highlight and style pattern converters. Fix pattern parsing to allow nested patterns.

  • Allow the status logging to be directed to stderr or to a file.

  • Add interval and modulate options to TimeBasedTriggeringPolicy to allow more fine-grained control of when file rolling should occur. (LOG4J2-35)

  • Add support for filtering packages from stack traces. (LOG4J2-58)

  • If system property "disableThreadContextMap" is set puts to the ThreadContext will be ignored. If system property "disableThreadContext" is set both puts and pushes will be ignored. (LOG4J2-83)

  • If system property "disableThreadContextStack" is set pushes to the ThreadContext will be ignored. If system property "disableThreadContext" is set both puts and pushes will be ignored. (LOG4J2-84)

Changed

  • Made ParameterizedMessage, StringFormattedMessage and ThreadDumpMessage immutable. LocalizedMessage is immutable except that it will be updated with the logger name when it is added to the LogEvent.

Fixed

  • DefaultConfiguration was not starting the Console Appender.

  • If the ThreadContext map is empty the LogEvent will contain a null value to reduce the overhead of creating log events and in the size of the serialized object. (LOG4J2-83)

  • If the ThreadContext stack is empty the LogEvent will contain a null value to reduce the overhead of creating log events and in the size of the serialized object. Changed the ThreadContext stack to use a custom stack interface instead of java.util.Stack as that class is overly heavy. This change will cause an API incompatibility. (LOG4J2-84)

  • Many logging methods in AbstractLogger were set to an incorrect logging level. catching was using the THROWING marker and was set to debug instead of error. (LOG4J2-88)

  • Add documentation on client vs server mode to performance page. (LOG4J2-90)

  • Log4j 1.2 adapter’s Category class was missing 3 log methods. (LOG4J2-91)

  • Converted DynamicThresholdFilter to use KeyValuePair. Fixed bugs in the Map-based filters to allow declaration of multiple values for a key to match the documentation. (LOG4J2-92)

  • Move variable substitution from PatternLayout to appropriate converters to improve performance.

2.0-beta1

Release date

2012-09-18

Added

  • Added AsynchAppender.

Changed

  • Update the versions of SLF4J and Logback.

Fixed

  • Created web module to allow web applications to include the Log4j context listener in WEB-INF/lib even if Log4j is in the container’s class path. Allow locating the LoggerContext to include the ClassLoader. Updated the Loader utility to always choose the child ClassLoader. Verified in Jboss 5 and Tomcat.

  • FileRenameAction did not create the parent directories of the archive files causing the rollover to fail. (LOG4J2-71)

  • NullPointerException in RollingFileManager when filePattern does not cause the file to be compressed. (LOG4J2-72)

  • Logger.error(Marker, Message, Throwable) was internally using Level.TRACE. (LOG4J2-74)

  • Enhanced Log4jContextListener to accept a configuration file location. Modified FileConfigurationMonitor to monitor files configured that way. Fixed other reconfiguration related bugs. Tested in JBoss and Tomcat. (LOG4J2-75)

  • RewriteAppender was calling the stop method of the referenced appender causing the referenced appender’s manager to have its use count decremented too many times. (LOG4J2-76)

  • RoutingAppender was calling the stop method for each of its referenced Appenders and was calling the stop method of the default Appender a second time. It will now only call the stop method of Appenders it creates. (LOG4J2-77)

  • LogFactoryImpl.setAttribute in the Commons Logging bridge got a NullPointerException when passed a null value. It will now remove the attribute. (LOG4J2-78)

  • Allow Log4j 2 to be used as the implementation with SLF4J and SLF4J’s jcl-over-slf4j by adding filtering to the log method in SLF4JLogger. (LOG4J2-80)

  • PatternLayout was not honoring format modifiers. (LOG4J2-81)

  • MarkerFilter called MarkerManager.getMarker causing the Marker to be created during the processing of the configuration. This prevents the application from creating the Marker with any parents. MarkerWrapper in SLF4J-impl was getting a ClassCastException in instanceOf because the Marker isn’t a MarkerWrapper. (LOG4J2-82)

2.0-alpha2

Release date

2012-08-24

Added

  • Allow components besides core to create a PluginMap for faster plugin loading and not having to specify the plugin package in the configuration. (LOG4J2-67)

  • Add support for formatting using String.format(). (LOG4J2-68)

  • Allow Flume agents to be embedded into the Flume Appender. (LOG4J2-69)

  • Add getLogger(Class) to LogManager. (LOG4J2-70)

Fixed

  • Fix compilation problems in Java 7. (LOG4J2-64)

  • Allow variable substitution on the configuration attributes and on the root log level. (LOG4J2-65)

2.0-alpha1

Release date

2012-07-29

Added

  • Added ability to filter on the AppenderRef by adding either a level or a filter. (LOG4J2-60)

Fixed

  • Make sure all application facing log methods use their own FQCN. This patch resolves a unit test failure for the %C pattern when using the Category logger. (LOG4J2-50)

  • Remove LoggerContext support for custom logger factories. All Loggers returned by LoggerContext should be compatible and of the same type. (LOG4J2-51)

  • Level.toLevel would throw an IllegalArgumentException instead of returning the default value. (LOG4J2-56)