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

Changes

Added

  • [core] Add and implement LogEvent.toImmutable(). (for LOG4J2-1807 by Gary Gregory)

  • Remove deprecation on MessageSupplier lambda functions in Logger API. (for LOG4J2-1823 by Matt Sicker)

Changed

  • Update to use Logback 1.1.10 and then Logback 1.2 for tests. (for LOG4J2-1810 by Ralph Goers)

  • Improved error message when log4j 2 configuration file not found. (for LOG4J2-1812 by Remko Popma)

  • Update Jackson from 2.8.5 to 2.8.6. (for LOG4J2-1819 by Gary Gregory)

  • Update SLF4J to 1.7.24. (for LOG4J2-1822 by Ralph Goers)

Fixed

  • Fix ClassNotFoundException org.apache.logging.log4j.core.util.ExecutorServices in OSGi tests. (for LOG4J2-1753 by Gary Gregory, Ludovic Hochet)

  • Fixed bug in PropertiesUtil::getCharsetProperty that caused UnsupportedCharsetException for ConsoleAppender. (for LOG4J2-1799 by Remko Popma, Eduard Gizatullin)

  • Report errors when sending to Kafka when using syncSend=false. (for LOG4J2-1800 by Mikael Ståldal, Vincent Tieleman)

  • Fix Maven POM to ensure JMH generated classes in log4j-perf are included in benchmarks jar. (for LOG4J2-1803 by Ralph Goers)

  • Allow %i in file pattern to be preceded with characters other than just '-'. (for LOG4J2-1804 by Ralph Goers, Pierrick Hymbert)

  • Fixed rare race condition in FixedDateFormat, made FixedDateFormat::millisSinceMidnight method public. (for LOG4J2-1805 by Remko Popma)

  • Fix Javadoc for DefaultRolloverStrategy::purgeAscending (for LOG4J2-1806 by Remko Popma, challarao)

  • Change minOccur to minOccurs in Log4j-config.xsd. (for LOG4J2-1816 by Remko Popma, shubhankar1100)

  • Fix rollover to work when filePattern contains no directory components. (for LOG4J2-1818 by Gary Gregory, xkr47)