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
FileExtensionmethods to allow their usage in customRolloverStrategys (1365, 1683) -
Bumped the minimum Java version required for the build to JDK 11. Runtime requirements remain unchanged. (1369)
-
Set the default
minLevelandmaxLevelofLevelRangeFiltertoOFFandALL, respectively (1503) -
Removed additional
isFilteredchecks inAsyncLoggerConfig(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 validBundleContextfor a service type -
Implemented a CI-based release process
-
Update
com.datastax.cassandra:cassandra-driver-coreto version 3.11.5 (1591) -
Update
org.mongodb:mongodb-driver-coreto version 4.10.2 (1591) -
Update
io.netty:netty-bomto version 4.1.97 (1591) -
Update Tomcat JULI to version 10.0.27 (1591)
Removed
-
Moved
log4j-jmx-guito its own repository along with its own release cycle
Fixed
-
Added validation to rolling file manager path conditions (1231)
-
Adapted the OSGi metadata of
log4j-to-slf4jto work with SLF4J 1 and 2. To achieve that used a version range of[1.7,3)for the imported SLF4J packages. (1232) -
Removed locale-dependent
toLowerCase/toUpperCasecalls (1281) -
Redirected old
/<module>/apidocsURLs (broken in 2.20.0) to/javadoc/<module>(1284) -
Added environment variable arbiter (1312)
-
Fixed logging of
java.sql.Dateobjects by appending it before Log4J tries to calljava.util.Date.toInstant()on it (1366) -
Adapted the OSGi metadata of
log4j-api,log4j-core,log4j-slf4j-implandlog4j-slf4j2-implto activate the bundle when it is accessed. To achieve that set theBundle-ActivationPolicytolazyfor the log4j bundles. (1367) -
Avoided using released objects in
StackTraceStringResolverofJsonTemplateLayout(1380) -
Added missing setter for
connectionStringSourceinMongoDb4Providerbuilder (1389) -
Fixed NPE in
PluginElementVisitor(1391) -
Added
columnTypeas alias for the column mappingtypeattribute (1405) -
Restored
Log4jMarkervisibility in SLF4J adapters (1414) -
Fixed buffer size in
Log4jFixedFormatterdate time formatter (1418) -
Fixed the propagation of synchronous action failures in
RollingFileManagerandFileRenameAction(1445, 1549) -
Fixed
RollingFileManagerto propagate failed synchronous actions correctly (1445) -
Replaced the usage of
System.outinStackLocatorfor warnings withSystem.err(1484) -
Fixed concurrent date-time formatting issue in
PatternLayout(1485) -
Fixed runtime dependencies documentation (1530)
-
Allowed to override FQCN in
Log4jEventBuilderby implementingCallerBoundaryAware(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
StackTraceElementon JDK 9+ (1640) -
Fixed
MemoryMappedFileAppenderbuffer unmapping on JRE 9+ (1646) -
Fixed rollover strategy in the Log4j 1.x compatibility layer (1650)
-
Removed incorrect mention of
base64lookup and improve the rest of the lookup manual (1681, LOG4J2-3504) -
Implemented
LocationAwareforJsonTemplateLayout, since this was causing location not being passed to underlying appenders (1692) -
Added support for
longvalues in MongoDb 4 appender to configurecollectionSize(1747) -
Only shutdown Log4j after last
Log4jServletContextListeneris 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
JsonTemplateLayoutNPE thrown on custom log levels (1805) -
Improved
Log4j-config.xsdschema (LOG4J2-170) -
Fixed NPE in
ContextSelector(LOG4J2-3217, 1538) -
Avoided allocating
ThreadLocals inAbstractLoggerwhen they are disabled, since this was causing memory leaks due to retained reference to class loaders in web applications (LOG4J2-3657) -
Fixed
%notEmptydirective ofPatternLayoutfor empty MDC/NDC inputs (LOG4J2-3660) -
Fixed file descriptor leak on Tomcat (LOG4J2-3663)
-
Ensured
FileOutputStreamis closed inCommonsCompressAction.execute()


