2.8 (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);


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.



  • Make DefaultRolloverStrategy more efficient when renaming files. Add nomax option to the fileIndex attribute. (for LOG4J2-1032 by Ralph Goers)

  • RollingFileAppender now supports omitting the file name and writing directly to the archive files. (for LOG4J2-1101 by Ralph Goers)

  • Allow default value in property to be a Lookup. (for LOG4J2-1243 by Ralph Goers)

  • Add documentation regarding YAML configuration format. (for LOG4J2-1379 by Matt Sicker)

  • Added public method ThreadContext::getThreadContextMap; removed class ThreadContextAccess. (for LOG4J2-1660 by Remko Popma)

  • Introduce interfaces IndexedStringMap and IndexedReadOnlyStringMap, supporting garbage-free iteration over sorted map. (for LOG4J2-1681 by Remko Popma)

  • Add a Builder to ScriptPatternSelector and deprecate ScriptPatternSelector.createSelector(). (for LOG4J2-1695 by Gary Gregory)

  • Add a Builder to MarkerPatternSelector and deprecate MarkerPatternSelector.createSelector(). (for LOG4J2-1696 by Gary Gregory)

  • Add a SerializerBuilder to PatternLayout and deprecate PatternLayout.createSerializer(). (for LOG4J2-1697 by Gary Gregory)

  • Add a Builder to RandomAccessFileAppender and deprecate RandomAccessFileAppender.createAppender(). (for LOG4J2-1701 by Gary Gregory)

  • Add a Builder to MemoryMappedFileAppender and deprecate MemoryMappedFileAppender.createAppender(). (for LOG4J2-1703 by Gary Gregory)

  • Add a Builder to RollingRandomAccessFileAppender and deprecate RollingRandomAccessFileAppender.createAppender(). (for LOG4J2-1704 by Gary Gregory)

  • Allow TCP Socket Appender to set socket options. (for LOG4J2-1707 by Gary Gregory)

  • Allow Secure Socket Appender to set socket options. (for LOG4J2-1708 by Gary Gregory)

  • Add a Builder to SyslogAppender and deprecate SyslogAppender.createAppender(). (for LOG4J2-1709 by Gary Gregory)

  • Introduce marker interface AsynchronouslyFormattable. (for LOG4J2-1718 by Remko Popma)

  • Add Apache Cassandra appender and ColumnMapping plugin. (for LOG4J2-1730 by Matt Sicker)

  • Add SyncSend attribute to KafkaAppender (as in KafkaLog4jAppender). (for LOG4J2-1733 by Gary Gregory, Vincent Tieleman)

  • Add a Builder to SyslogLayout and deprecate SyslogLayout.createLayout(Facility, boolean, String, Charset). (for LOG4J2-1737 by Gary Gregory)

  • 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). (for LOG4J2-1738 by Gary Gregory)

  • Add Builder to KafkaAppender and deprecate KafkaAppender.createAppender(Layout, Filter, String, boolean, String, Property[], Configuration). (for LOG4J2-1739 by Gary Gregory)

  • Add TypeConverter and constraint validators for java.net.InetAddress and port numbers. (for LOG4J2-1755 by Matt Sicker)

  • Add TypeConverter for java.nio.file.Path. (for LOG4J2-1758 by Matt Sicker)

  • Add TypeConverter for java.util.UUID. (for LOG4J2-1759 by Matt Sicker)

  • Use MethodHandle in ContextDataFactory cached constructor. (for LOG4J2-1764 by Matt Sicker)

  • Add a Builder to JdbcAppender and deprecate JdbcAppender.createAppender(). (for LOG4J2-1770 by Matt Sicker)

  • Add a Builder to ColumnConfig and deprecate ColumnConfig.createColumnConfig(). (for LOG4J2-1771 by Matt Sicker)

  • Add StatusLoggerRule to allow unit tests to set a status level. (for LOG4J2-1773 by Matt Sicker)

  • Document how to exclude transitive conflicting dependencies in Maven and Gradle. (for LOG4J2-1787 by Matt Sicker)

  • Add non-string data type support to JdbcAppender via new ColumnMapping plugin. (for LOG4J2-424 by Matt Sicker)

  • Refactor SyslogAppender so that Layout is a Plugin element. (for LOG4J2-969 by Gary Gregory)


  • 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. (for LOG4J2-1302 by Remko Popma)

  • Update JeroMQ from 0.3.5 to 0.3.6. (for LOG4J2-1641 by Gary Gregory)

  • Inefficient locking in AbstractLoggerAdapter. (for LOG4J2-1644 by Gary Gregory, Tim Gokcen, Pavel Sivolobtchik)

  • Migrate to Mockito 2.x in unit tests. (for LOG4J2-1646 by Matt Sicker)

  • Update Commons Lang from 3.4 to 3.5. (for LOG4J2-1647 by Matt Sicker)

  • Update Jackson from 2.8.3 to 2.8.4. (for LOG4J2-1655 by Gary Gregory)

  • Update Apache Flume from 1.6.0 to 1.7.0. (for LOG4J2-1656 by Gary Gregory)

  • Update LMAX Disruptor from 3.3.5 to 3.3.6. (for LOG4J2-1698 by Gary Gregory)

  • Update Jansi from 1.13 to 1.14. (for LOG4J2-1700 by Gary Gregory)

  • Update Jackson from 2.8.4 to 2.8.5. (for LOG4J2-1735 by Gary Gregory)

  • Update Kafka from to (for LOG4J2-1750 by Gary Gregory)

  • Update liquibase-core from 3.5.1 to 3.5.3. (for LOG4J2-1751 by Gary Gregory)

  • Replace MockEJB dependency in unit tests with Spring Test and Mockito. (for LOG4J2-1774 by Matt Sicker)

  • Update Conversant Disruptor from 1.2.7 to 1.2.10 (for LOG4J2-1781 by Matt Sicker)


  • Improve LogEvent serialization to handle non-serializable Messages and deserializing when required classes are missing. (for LOG4J2-1226 by Remko Popma)

  • CronTriggeringPolicy raise exception and fail to rollover log file when evaluateOnStartup is true. (for LOG4J2-1474 by Gary Gregory, yin mingjun, Neon)

  • Configurable JVM shutdown hook timeout. (for LOG4J2-1623 by Mikael Ståldal)

  • Fixed file locking regression in FileAppender introduced in 2.6. (for LOG4J2-1628 by Remko Popma)

  • Console Appender does not pick up Oracle Java 8’s sun.stdout.encoding and sun.stderr.encoding. (for LOG4J2-1636 by Gary Gregory, Eldar Gabdullin)

  • Fixed problems when used in OSGi containers (IllegalAccessError, NoClassDefFoundError). (for LOG4J2-1637 by Remko Popma)

  • Fix MemoryMappedFileAppender.createAppender() Javadoc for immediateFlush. (for LOG4J2-1639 by Gary Gregory, Sridhar Gopinath)

  • DefaultShutdownCallbackRegistry can throw a NoClassDefFoundError. (for LOG4J2-1642 by Gary Gregory, Johno Crawford)

  • Immutable empty StringMap. (for LOG4J2-1645 by Mikael Ståldal)

  • Insure the ConfigurationScheduler shuts down without blocking. (for LOG4J2-1649 by Ralph Goers, Georg Friedrich)

  • CronTriggeringPolicy would use the wrong date/time when rolling over and create multiple triggering policies on reconfiguration. (for LOG4J2-1653 by Ralph Goers, Georg Friedrich)

  • Prevent NPE in ThreadContextMapFactory::createThreadContextMap when initializing Log4j with Configurator::initialize and the BasicContextSelector is used. (for LOG4J2-1658 by Remko Popma)

  • Ensure SortedArrayStringMap can be serialized and deserialized without errors regardless of content. (for LOG4J2-1663 by Remko Popma)

  • Improve OSGi unit tests. (for LOG4J2-1664 by Gary Gregory, Ludovic HOCHET)

  • (GC) Avoid allocating temporary objects in IntegerPatternConverter. (for LOG4J2-1665 by Remko Popma)

  • (GC) Avoid allocating temporary objects in RelativeTimePatternConverter. (for LOG4J2-1666 by Remko Popma)

  • (GC) Avoid allocating temporary objects in SequenceNumberPatternConverter. (for LOG4J2-1667 by Remko Popma)

  • (GC) Avoid allocating temporary objects in MarkerPatternConverter. (for LOG4J2-1668 by Remko Popma)

  • (GC) Avoid allocating temporary objects in MaxLengthConverter. (for LOG4J2-1669 by Remko Popma)

  • (GC) Avoid allocating temporary objects in EqualsReplacementConverter. (for LOG4J2-1670 by Remko Popma)

  • (GC) Avoid allocating temporary objects in EqualsIgnoreCaseReplacementConverter. (for LOG4J2-1671 by Remko Popma)

  • (GC) Avoid allocating temporary objects in LevelRangeFilter. (for LOG4J2-1672 by Remko Popma)

  • (GC) Avoid allocating temporary objects in MarkerFilter. (for LOG4J2-1673 by Remko Popma)

  • (GC) Avoid allocating temporary objects in ThresholdFilter. (for LOG4J2-1674 by Remko Popma)

  • Some LogEvents may not carry a Throwable (Use Message.getThrowable() in log(Message) methods.) (for LOG4J2-1676 by Gary Gregory, Joern Huxhorn)

  • (GC) Avoid allocating temporary objects in MapFilter. (for LOG4J2-1677 by Remko Popma)

  • (GC) Avoid allocating temporary objects in ThreadContextMapFilter. (for LOG4J2-1678 by Remko Popma)

  • (GC) Avoid allocating temporary objects in StructuredDataFilter. (for LOG4J2-1679 by Remko Popma)

  • (GC) Avoid allocating temporary objects in TimeFilter. (for LOG4J2-1680 by Remko Popma)

  • Logger using LocalizedMessageFactory prints key instead of message. (for LOG4J2-1682 by Gary Gregory, Markus Waidhofer)

  • (GC) Avoid allocating temporary objects in MapMessage. (for LOG4J2-1683 by Remko Popma)

  • Option 'disableAnsi' in PatternLayout to unconditionally disable ANSI escape codes. (for LOG4J2-1685 by Mikael Ståldal, Raman Gupta)

  • NPE in ThrowableProxy when resolving stack in Java EE/OSGi environment. (for LOG4J2-1687 by Gary Gregory, Robert Christiansen)

  • Fixed bug where elements of a log message parameter array were nulled out in garbage-free mode. (for LOG4J2-1688 by Remko Popma)

  • Add CleanableThreadContextMap interface supporting method removeAll(Iterable<String>). (for LOG4J2-1689 by Mikael Ståldal)

  • Add putAll() method to CloseableThreadContext. (for LOG4J2-1692 by Mikael Ståldal, Greg Thomas)

  • Make TimeFilter usable as global filter and as logger filter. (for LOG4J2-1706 by Remko Popma)

  • Pick up bug fixes from Apache Commons Lang’s org.apache.commons.lang3.time package. (for LOG4J2-1712 by Gary Gregory)

  • (GC) Avoid allocating temporary objects in AbstractStyleNameConverter. (for LOG4J2-1714 by Remko Popma)

  • (GC) Avoid allocating temporary objects in NdcPatternConverter. (Note that use of the ThreadContext stack is not garbage-free.) (for LOG4J2-1715 by Remko Popma)

  • (GC) Avoid allocating temporary objects in MapPatternConverter. (Note that constructing a MapMessage is not garbage-free.) (for LOG4J2-1716 by Remko Popma)

  • (GC) Avoid allocating temporary objects in EncodingPatternConverter. (for LOG4J2-1717 by Remko Popma)

  • Fixed race condition in ObjectMessage and SimpleMessage, ensuring that the log message contains the value the object has during the logging call. (for LOG4J2-1719 by Remko Popma)

  • Make GelfLayout independent of Jackson. (for LOG4J2-1720 by Mikael Ståldal)

  • (GC) Avoid allocating temporary objects in VariablesNotEmptyReplacementConverter. (for LOG4J2-1722 by Remko Popma)

  • Unwanted transitive dependency on geronimo-jms_1.1_spec causes OSGi tests to fail. (for LOG4J2-1723 by Gary Gregory, Ludovic HOCHET)

  • Using variables in GelfLayout’s additional fields at runtime. (for LOG4J2-1724 by Mikael Ståldal, Alexander Krasnostavsky)

  • SslSocketManager now respects connectTimeoutMillis. (for LOG4J2-1731 by Remko Popma, Chris Ribble)

  • SslSocketManagerFactory might leak Sockets when certain startup errors occur. (for LOG4J2-1734 by Gary Gregory)

  • TcpSocketManagerFactory might leak Sockets when certain startup errors occur. (for LOG4J2-1736 by Gary Gregory)

  • Add CronTriggeringPolicy programmatically leads to NPE. (for LOG4J2-1740 by Gary Gregory)

  • CompositeConfiguration does not add filters to appenderRefs. (for LOG4J2-1743 by Gary Gregory, Toby Shepheard)

  • The custom logger Generate tool no longer requires the log4j-api module on the classpath. (for LOG4J2-1744 by Remko Popma)

  • Do not use non-daemon thread pool for rollover tasks. (for LOG4J2-1748 by Mikael Ståldal)

  • Adds xmlns in schema and some other tags. (for LOG4J2-1756 by Gary Gregory, shubhankar1100)

  • Add Builder to GelfLayout. (for LOG4J2-1762 by Mikael Ståldal)

  • Fixed concurrency issue affecting all layouts except PatternLayout and GelfLayout, which caused scrambled output and exceptions when logging synchronously from multiple threads. (for LOG4J2-1769 by Remko Popma, Brandon Goodin)

  • Fixed bug where AsyncLogger did not resolve configuration properties. (for LOG4J2-1779 by Remko Popma)

  • Eliminate the use of the ExecutorServices in the LoggerContext. (for LOG4J2-1780 by Mikael Ståldal)

  • ConfigurationScheduler now preserves interrupt flag during stop. (for LOG4J2-1786 by Remko Popma)

  • Cannot define both filters and separator for PatternLayout %xEx. (for LOG4J2-2195 by Gary Gregory, Raman Gupta)

  • RootThrowablePatternConverter does not use TextRenderer or line separator options. (for LOG4J2-2221 by Gary Gregory, Raman Gupta)