2.18.0 (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.

Changes

Added

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

  • Add support for custom Log4j 1.x levels. (for LOG4J2-3419 by Piotr P. Karwasz)

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

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

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

  • Add MutableThreadContextMapFilter. (for LOG4J2-3495 by Ralph Goers)

  • Add support for 24 colors in highlighting (for LOG4J2-3538 by Piotr P. Karwasz, Pavel_K)

Changed

  • Improves ServiceLoader support on servlet containers. (for LOG4J2-3427 by Piotr P. Karwasz)

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

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

  • Support Spring 2.6.x. (for LOG4J2-3506 by Ralph Goers)

  • Move perf tests to log4j-core-its (for LOG4J2-3516 by Ralph Goers)

  • Upgrade the Flume Appender to Flume 1.10.0 (for LOG4J2-3536 by Ralph Goers)

Fixed

  • Fix minor typo #792. (for by Gary Gregory, LF-Lin)

  • Improve validation and reporting of configuration errors. (for by Piotr P. Karwasz)

  • Allow enterprise id to be an OID fragment. (for LOG4J2-1376 by Piotr P. Karwasz, Mark Niggemann)

  • Fix problem with non-uppercase custom levels. (for LOG4J2-2872 by Piotr P. Karwasz, Alla Gofman)

  • Avoid ClassCastException in JeroMqManager with custom LoggerContextFactory #791. (for LOG4J2-3040 by Gary Gregory, LF-Lin)

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

  • Fixes the syslog appender in Log4j 1.x bridge, when used with a custom layout. (for LOG4J2-3359 by Piotr P. Karwasz, Tukesh)

  • log4j-1.2-api 2.17.2 throws NullPointerException while removing appender with name as null. (for LOG4J2-3359 by Gary Gregory, Rajesh)

  • Improve JsonTemplateLayout performance. (for LOG4J2-3393 by Volkan Yazıcı)

  • Fix resolution of non-Log4j properties. (for LOG4J2-3413 by Piotr P. Karwasz)

  • Fixes Spring Boot logging system registration in a multi-application environment. (for LOG4J2-3418 by Piotr P. Karwasz)

  • JAR file containing Log4j configuration isn’t closed. (for LOG4J2-3423 by Gary Gregory, Radim Tlusty)

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

  • Syslog appender lacks the SocketOptions setting. (for LOG4J2-3425 by Gary Gregory, Jiří Smolík)

  • Log4j 1.2 bridge should not wrap components unnecessarily. (for LOG4J2-3426 by Piotr P. Karwasz, Pooja Pandey)

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

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

  • Fixes default SslConfiguration, when a custom keystore is used. (for LOG4J2-3439 by Piotr P. Karwasz, Jayesh Netravali)

  • Fixes appender concurrency problems in Log4j 1.x bridge. (for LOG4J2-3447 by Piotr P. Karwasz, Pooja Pandey)

  • Fix and test for race condition in FileUtils.mkdir(). (for LOG4J2-3452 by Piotr P. Karwasz, Stefan Vodita)

  • LocalizedMessage logs misleading errors on the console. (for LOG4J2-3458 by Gary Gregory)

  • Add missing message parameterization in RegexFilter. (for LOG4J2-3475 by Piotr P. Karwasz, Jeremy Lin)

  • Add the missing context stack to JsonLayout template. (for LOG4J2-3477 by Volkan Yazıcı, filipc)

  • HttpWatcher did not pass credentials when polling. (for LOG4J2-3481 by Ralph Goers)

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

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

  • Async Loggers were including the location information by default. (for LOG4J2-3491 by Ralph Goers, Avihai Marchiano)

  • ClassArbiter’s newBuilder method referenced the wrong class. (for LOG4J2-3493 by Ralph Goers, Dmytro Voloshyn)

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

  • Fix parsing error, when XInclude is disabled. (for LOG4J2-3531 by Piotr P. Karwasz, Simo Nikula)

  • Fix LevelRangeFilterBuilder to align with log4j1’s behavior. (for LOG4J2-3534 by Piotr P. Karwasz, Yohei Ueki)

  • Fixes problem with wrong ANSI escape code for bright colors (for LOG4J2-3537 by Piotr P. Karwasz, Pavel_K)

  • Log4j 1.2 bridge should generate Log4j 2.x messages based on the parameter runtime type. (for by Piotr P. Karwasz)