Apache Log4j 2 is a versatile, feature-rich, efficient logging API and backend for Java.
This release contains several small fixes and some dependency updates.
CloseableThreadContext#closeMap()
(#2296)LoggerContextAware
lookups (#2309)PatternProcessor
for a UNIX_MILLIS
pattern (#2346)StatusLogger
log level filtering when debug mode is enabled (#2337)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)StatusLogger
to correctly read log4j2.StatusLogger.properties
resource (#2354)StatusLogger
(#2322)jakarta.activation:jakarta.activation-api
to version 2.1.3
(#2335)jakarta.mail:jakarta.mail-api
to version 2.1.3
(#2348)org.apache.commons:commons-compress
to version 1.26.0
(#2304)org.apache.commons:commons-dbcp2
to version 2.12.0
(#2344)org.apache.kafka:kafka-clients
to version 3.7.0
(#2326)org.eclipse.angus:angus-activation
to version 2.0.2
(#2336)org.eclipse.angus:jakarta.mail
to version 2.0.3
(#2349)This release provides a continuation of the modularization process of Log4j Core.
The following features were moved to separate artifacts:
log4j-async-logger
and it was upgraded to use LMAX Disruptor 4.x. The async appender is still available by default in log4j-core
.log4j-config-yaml
.jackson-dataformat-properties
in a new log4j-config-properties
artifact.Other features were removed:
log4j-appserver
with log4j-slf4j2-impl
.commons-logging
to version 1.3.0 or later and remove log4j-jcl
.ConfigurationExtension
mechanism to allow third-party JARs to extend the <Configuration>
element.jackson-dataformat-properties
.FormattedMessage
formatters. Messages are evaluated using java.util.Format
only if they don't comply to the java.text.MessageFormat
or ParameterizedMessage
format. (#1223)log4j-async-logger
module.log4j-config-yaml
module.collectionSize
(#1747)JdkMapAdapterStringMap
as frozen if map is immutable. (#2098)JdkMapAdapterStringMap
performance. (#2238)CloseableThreadContext
. (#1426)RollingFileManager
. (#1645)log4j-spring-cloud-config-client
dependencies to include only those required. (2157)log4j-slf4j-impl
and log4j-mongodb3
. (#2065)2.x
properties configuration factory.DefaultLogEventFactory
log4j-appserver
module (#2257)org.apache.logging.log4j.core.parser
and related packages. (#2154)log4j-jcl
module (#2257)log4j-layout-jackson
module (#2198)log4j-layout-jackson-xml
module (#2198)log4j2.enable.threadlocals
property (#2105)com.fasterxml.jackson:jackson-bom
to version 2.16.1
(#2127)commons-codec:commons-codec
to version 1.16.1
(#2276)io.netty:netty-bom
to version 4.1.107.Final
(#2283)org.apache.logging:logging-parent
to version 10.6.0
(#2193)org.apache.tomcat:tomcat-juli
to version 10.1.18
(#2176)org.eclipse.jetty:jetty-bom
to version 9.4.54.v20240208
(#2285)org.jctools:jctools-core
to version 4.0.3
(#2267)org.slf4j:slf4j-api
to version 2.0.10
(#2136)org.springframework.boot:spring-boot-autoconfigure
to version 3.2.2
(#2222)org.springframework.cloud:spring-cloud-context
to version 4.1.1
(#2236)org.springframework:spring-framework-bom
to version 6.1.4
(#2294)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.
6.4.1
to 7.0.0
verbose
(i.e., <Configuration verbose="..."
) and StatusConsoleListener
filters (#2226)RingBufferLogEventHandler
class for removal from the public API in 3.xJdkMapAdapterStringMap
performance. (#2238)Logger#setLevel
and Logger#getLevel
in the Log4j 1.2 bridge. (#2282)CoreLogger#getLevel
and CoreLogger#setLevel
in the log4j-jul
module. (#2282)threadName
field in RingBufferLogEvent#clear()
. (#2234)StringBuilder
cache corruption on recursive access.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)log4j-spring-cloud-config-client
dependencies to include only those required. (#2157)clientKeyData
configuration property.com.fasterxml.jackson:jackson-bom
to version 2.16.1
(#2126)commons-codec:commons-codec
to version 1.16.1
(#2277)io.netty:netty-bom
to version 4.1.107.Final
(#2284)org.apache.logging:logging-parent
to version 10.6.0
(#2197)org.eclipse.jetty:jetty-bom
to version 9.4.54.v20240208
(#2287)org.jctools:jctools-core
to version 4.0.3
(#2270)org.springframework:spring-framework-bom
to version 5.3.32
(#2293)org.zeromq:jeromq
to version 0.6.0
(#2271)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.
JdkMapAdapterStringMap
as frozen if map is immutable. (#2098)CloseableThreadContext
. (#1426)1.2.16+
of the library.RollingFileManager
. (#1645)log4j-to-slf4j
JPMS and OSGi descriptors. (#1983)log4j-slf4j-impl
and log4j-mongodb3
. (#2065)com.github.luben:zstd-jni
to version 1.5.5-11
(#2030)com.google.guava:guava
to version 33.0.0-jre
(#2110)commons-codec:commons-codec
to version 1.16.0
(#2042)commons-io:commons-io
to version 2.15.1
(#2034)commons-logging:commons-logging
to version 1.3.0
(#2050)io.netty:netty-bom
to version 4.1.104.Final
(#2095)org.apache.commons:commons-compress
to version 1.25.0
(#2045)org.apache.commons:commons-dbcp2
to version 2.11.0
(#2048)org.apache.commons:commons-lang3
to version 3.14.0
(#2047)org.apache.commons:commons-pool2
to version 2.12.0
(#2057)org.apache.kafka:kafka-clients
to version 3.6.1
(#2068)org.apache.logging:logging-parent
to version 10.5.0
(#2119)org.jctools:jctools-core
to version 4.0.2
(#1984)org.springframework.boot:spring-boot
to version 2.7.18
(#1998)org.springframework.cloud:spring-cloud-dependencies
to version 2021.0.9
(#2109)This is the first beta release of the upcoming major release, i.e., 3.0.0
.
Optional<T>
, Collection<T>
, Set<T>
, Stream<T>
, List<T>
, and Map<String, T>
. (LOG4J2-3496)ConstraintValidator
in plugin classes. (LOG4J2-3497)synchronized
blocks with locks for improved performance with virtual threads. (#1532)isFiltered
checks in AsyncLoggerConfig
. (#1550)com.lmax:disruptor
to version 4.0.0
(#1829)actions/checkout
to version 4.1.1
(#1869)actions/setup-java
to version 3.13.0
(#1809)actions/setup-python
to version 4.7.1
(#1831)ch.qos.logback:logback-classic
to version 1.4.14
(#2028)com.datastax.cassandra:cassandra-driver-core
to version 3.11.5
(#1889)com.fasterxml.jackson:jackson-bom
to version 2.16.0
(#1974)com.github.luben:zstd-jni
to version 1.5.5-11
(#2032)com.github.spotbugs:spotbugs-maven-plugin
to version 4.7.3.6
(#1879)com.github.tomakehurst:wiremock-jre8
to version 2.35.1
(#1765)com.google.code.java-allocation-instrumenter:java-allocation-instrumenter
to version 3.3.4
(#2102)com.google.errorprone:error_prone_core
to version 2.23.0
(#1871)com.google.guava:guava-testlib
to version 32.1.3-jre
(#1934)com.h2database:h2
to version 2.2.224
(#1917)commons-codec:commons-codec
to version 1.16.0
(#2054)commons-io:commons-io
to version 2.15.1
(#2035)commons-logging:commons-logging
to version 1.3.0
(#2046)de.flapdoodle.reverse:de.flapdoodle.reverse
to version 1.7.2
(#2000)io.netty:netty-bom
to version 4.1.104.Final
(#2097)net.java.dev.jna:jna
to version 5.14.0
(#2082)org.apache.aries.spifly:org.apache.aries.spifly.dynamic.bundle
to version 1.3.7
(#2053)org.apache.commons:commons-compress
to version 1.25.0
(#2055)org.apache.commons:commons-csv
to version 1.10.0
(#2041)org.apache.commons:commons-dbcp2
to version 2.11.0
(#2044)org.apache.commons:commons-lang3
to version 3.14.0
(#2036)org.apache.commons:commons-pool2
to version 2.12.0
(#2038)org.apache.groovy:groovy-bom
to version 4.0.16
(#2039)org.apache.maven:maven-core
to version 3.9.6
(#2049)org.apache.maven.surefire:surefire-junit47
to version 3.2.3
(#2091)org.apache.tomcat:tomcat-juli
to version 10.1.17
(#2086)org.codehaus.plexus:plexus-utils
to version 3.5.1
(#2061)org.eclipse.jetty:jetty-bom
to version 9.4.53.v20231009
(#1931)org.eclipse.persistence:org.eclipse.persistence.jpa
to version 2.7.13
(#1933)org.eclipse.platform:org.eclipse.osgi
to version 3.18.600
(#2064)org.elasticsearch.client:elasticsearch-rest-high-level-client
to version 7.17.16
(#2085)org.graalvm.truffle:truffle-api
to version 23.1.1
(#1872)org.jctools:jctools-core
to version 4.0.2
(#1995)org.jmdns:jmdns
to version 3.5.9
(#2069)org.junit:junit-bom
to version 5.10.1
(#1993)org.junit-pioneer:junit-pioneer
to version 2.2.0
(#1986)org.mockito:mockito-bom
to version 5.8.0
(#2031)org.mongodb:bson
to version 4.11.1
(#1991)org.springframework.boot:spring-boot
to version 2.7.17
(#1902)org.springframework.boot:spring-boot-dependencies
to version 2.7.18
(#2002)org.springframework:spring-framework-bom
to version 5.3.30
(#1903)org.springframework:spring-test
to version 5.3.31
(#1992)org.xerial.snappy:snappy-java
to version 1.1.10.5
(#1877)org.zeromq:jeromq
to version 0.5.4
(#1888)uk.org.webcompere:system-stubs-core
to version 2.1.5
(#2001)GelfLayout
(a GELF-compatible layout is still possible using JSON Template Layout) (#1951)log4j-cassandra
(#1951)log4j-couchdb
(#1951)log4j-jakarta-jms
, log4j-jakarta-smtp
, and log4j-jakarta-web
) to their own repository and website (#1966)log4j-jms
, log4j-jpa
, log4j-smtp
, log4j-web
(#1966)log4j-jeromq
module (users are recommended to migrate to loghublog4j2) (#1951)log4j-kafka
(#1951)log4j-layout-jackson-json
module (it is superseded by JSON Template Layout) (#1951)log4j-layout-jackson-yaml
module (#1951)ServiceLoader
mechanism should be used instead.log4j-mongodb3
module (#1951)SecurityManager
. Starting in Java 21, a custom SecurityManager
cannot be used.log4j-spring-boot
module (its features are upstreamed to org.springframework.boot:spring-boot-starter-log4j2
) (#1951)toLowerCase/toUpperCase
calls. (#1281)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)Log4jEventBuilder
by implementing CallerBoundaryAware
. (#1533)Log4jServletContextListener
is executed. (#1782)<AsyncLogger>
components are used with an all async logger context. (#1786)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.
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.
FormattedMessage
formatters. Messages are evaluated using java.util.Format
only if they don't comply to the java.text.MessageFormat
or ParameterizedMessage
format. (#1223)log4j2.configurationAuthorizationEncoding
property to overwrite it. (#1970)com.fasterxml.jackson:jackson-bom
to version 2.16.0
(#1974)com.github.luben:zstd-jni
to version 1.5.5-10
(#1940)com.google.guava:guava
to version 32.1.3-jre
(#1875)io.netty:netty-bom
to version 4.1.101.Final
(#1960)org.eclipse.persistence:org.eclipse.persistence.jpa
to version 2.7.13
(#1900)org.fusesource.jansi:jansi
to version 2.4.1
(#1907)org.mongodb:bson
to version 4.11.1
(#1957)org.springframework:spring-framework-bom
to version 5.3.30
org.springframework.boot:spring-boot
to version 2.7.17
(#1874)org.springframework:spring-framework-bom
to version 5.3.31
(#1973)org.zeromq:jeromq
to version 0.5.4
(#1878)FastDateParser
which was causing unnecessary heap overhead (LOG4J2-3672, #1848)%notEmpty
(#1922)log4j-layout-template-json
and log4j-1.2-api
(#1895)spring-test
dependency scope change (LOG4J2-3675)jlink
issues (#1896)Implementation-
and Specification-
entries to MANIFEST.MF
(implemented by logging-parent
version 10.3.0
update) (#1923)NotSerializableException
thrown when Logger
is serialized with a ReusableMessageFactory
(#1884)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.
log4j-jcl
. (#1865)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.
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 .
.
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.
JsonTemplateLayout
(#1381)FileExtension
methods to allow their usage in custom RolloverStrategy
s (#1365, #1683)minLevel
and maxLevel
of LevelRangeFilter
to OFF
and ALL
, respectively (#1503)isFiltered
checks in AsyncLoggerConfig
(#1550)StackLocator
(#1760)OsgiServiceLocator.loadServices(Class, Lookup, boolean)
when a bundle has no valid BundleContext
for a service typecom.datastax.cassandra:cassandra-driver-core
to version 3.11.5 (#1591)org.mongodb:mongodb-driver-core
to version 4.10.2 (#1591)io.netty:netty-bom
to version 4.1.97 (#1591)log4j-jmx-gui
to its own repository along with its own release cyclelog4j-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)toLowerCase/toUpperCase
calls (#1281)/<module>/apidocs
URLs (broken in 2.20.0) to /javadoc/<module>
(#1284)java.sql.Date
objects by appending it before Log4J tries to call java.util.Date.toInstant()
on it (#1366)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)StackTraceStringResolver
of JsonTemplateLayout
(#1380)connectionStringSource
in MongoDb4Provider
builder (#1389)PluginElementVisitor
(#1391)columnType
as alias for the column mapping type
attribute (#1405)Log4jMarker
visibility in SLF4J adapters (#1414)Log4jFixedFormatter
date time formatter (#1418)RollingFileManager
and FileRenameAction
(#1445, #1549)RollingFileManager
to propagate failed synchronous actions correctly (#1445)System.out
in StackLocator
for warnings with System.err
(#1484)PatternLayout
(#1485)Log4jEventBuilder
by implementing CallerBoundaryAware
(#1533)StackTraceElement
on JDK 9+ (#1640)MemoryMappedFileAppender
buffer unmapping on JRE 9+ (#1646)base64
lookup and improve the rest of the lookup manual (#1681, LOG4J2-3504)LocationAware
for JsonTemplateLayout
, since this was causing location not being passed to underlying appenders (#1692)long
values in MongoDb 4 appender to configure collectionSize
(#1747)Log4jServletContextListener
is executed (#1782)<AsyncLogger>
components are used with an all async logger context (#1786)JsonTemplateLayout
NPE thrown on custom log levels (#1805)Log4j-config.xsd
schema LOG4J2-170
ContextSelector
(LOG4J2-3217, #1538)ThreadLocal
s in AbstractLogger
when they are disabled, since this was causing memory leaks due to retained reference to class loaders in web applications LOG4J2-3657
%notEmpty
directive of PatternLayout
for empty MDC/NDC inputs LOG4J2-3660
FileOutputStream
is closed in CommonsCompressAction.execute()