2.9.0 (2017-08-26)

This release contains the first support of Java 9 as well as bugfixes and minor enhancements. The Log4j API was modified to use java.util.ServiceLoader to locate Log4j implementations, although the former binding mechanism is still supported. The Log4j JAR is now a multi-release JAR to provide implementations of the Java 9 specific classes. Multi-release JARs are not supported by the OSGi specification so OSGi modules will not be able to take advantage of these implementations but will not lose functionality as they will fall back to the implementations used in Java 7 and 8. More details on the new features and fixes are itemized below.

Note that subsequent to the 2.9.0 release, for security reasons, SerializedLayout is deprecated and no longer used as default in the Socket and JMS appenders. SerializedLayout can still be used as before, but has to be specified explicitly. To retain old behaviour, you have to change configuration like:

  <Socket name="socket" host="localhost" port="9500"/>


  <Socket name="socket" host="localhost" port="9500">

We do, however, discourage the use of SerializedLayout and recommend JsonLayout as a replacement:

  <Socket name="socket" host="localhost" port="9500">
    <JsonLayout properties="true"/>

Note that subsequent to the 2.9.0 release, for security reasons, Log4j does not process DTD in XML files. If you used DTD for including snippets, you have to use XInclude or Composite Configuration instead.

The Log4j 2.9.0 API, as well as many core components, maintains binary compatibility with previous releases.

Log4j 2.9.0 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.



  • The JMS Appender should use a JMS MapMessage for a Log4j MapMessage. (for LOG4J2-1294 by Gary Gregory)

  • Add support for Java 9 StackWalker. (for LOG4J2-1359 by Ralph Goers)

  • Generic HTTP appender. (for LOG4J2-1442 by Mikael Ståldal)

  • Configurable Log File Permissions with PosixFilePermission. (for LOG4J2-1699 by Gary Gregory, Demetrios Dimatos, Pierrick Hymbert)

  • Temporary compress directory during rollover (#88). (for LOG4J2-1766 by Gary Gregory, Pierrick HYMBERT)

  • Log4j2 will now print all internal logging to the console if system property log4j2.debug is defined with any value (or no value). (for LOG4J2-1813 by Remko Popma)

  • Added wrapper classes CustomLoggerGenerator and ExtendedLoggerGenerator to avoid class name with a dollar ($) character which has special meaning in many *nix command line environments. (for LOG4J2-1814 by Remko Popma)

  • Support null byte delimiter in GelfLayout. (for LOG4J2-1854 by Mikael Ståldal, Xavier Jodoin)

  • Add an optional random delay in TimeBasedTriggeringPolicy (for LOG4J2-1855 by Matt Sicker, Anthony Maire)

  • Shortcut to add Property and KeyValuePair component in ConfigurationBuilder. (for LOG4J2-1860 by Mikael Ståldal)

  • Support capped collections for MongoDb appender. (for LOG4J2-1864 by Matt Sicker, Matthias Kappeller)

  • Added methods ::writeBytes(ByteBuffer) and ::writeBytes(byte[], int, int) to ByteBufferDestination interface and use these methods in TextEncoderHelper where possible to prepare for future enhancements to reduce lock contention. (for LOG4J2-1874 by Remko Popma, Roman Leventov)

  • Warn when a configuration file for an inactive ConfigurationFactory is found. (for LOG4J2-1880 by Mikael Ståldal)

  • Added process ID (pid) pattern converter. (for LOG4J2-1884 by Remko Popma)

  • Add forEach() methods to org.apache.logging.log4j.message.MapMessage. (for LOG4J2-1930 by Gary Gregory)

  • Add containsKey() methods to org.apache.logging.log4j.message.MapMessage. (for LOG4J2-1932 by Gary Gregory)

  • JMS Appender does not know how to recover from a broken connection. (for LOG4J2-1934 by Gary Gregory)

  • Add with(String, primitive) methods to org.apache.logging.log4j.message.MapMessage. (for LOG4J2-1935 by Gary Gregory)

  • Generate source jas for all test jars. (for LOG4J2-1945 by Gary Gregory)

  • JMS Appender should be able to connect to a broker (later) even it is not present at configuration time. (for LOG4J2-1955 by Gary Gregory)

  • JsonLayout, XmlLayout and YamlLayout support 0-byte termination of log events. (for LOG4J2-1981 by Mikael Ståldal)

  • Public API for parsing the output from JsonLayout/XmlLayout/YamlLayout into a LogEvent. (for LOG4J2-1986 by Mikael Ståldal)

  • Support printing multiple StructuredData elements in RFC5424Layout. (for LOG4J2-2008 by Ralph Goers)


  • Allow for bufferSize=0 in SMTP appender. (for LOG4J2-1071 by Gary Gregory, Ben Ludkiewicz, Benjamin Jaton)

  • Async Loggers no longer use deprecated LMAX Disruptor APIs. (Disruptor-3.3.3 or higher is now required.) (for LOG4J2-1261 by Remko Popma)

  • Add more detail to WARN "Ignoring log event" messages printed to the console after log4j was shut down. (for LOG4J2-1801 by Remko Popma)

  • Move server components from log4j-core to new log4-server module. (for LOG4J2-1851 by Mikael Ståldal)

  • Update ZeroMQ’s JeroMQ from 0.3.6 to 0.4.0. (for LOG4J2-1868 by Gary Gregory)

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

  • Update JavaMail from 1.5.5 to 1.5.6. (for LOG4J2-1872 by Gary Gregory)

  • Missing documentation for Max index limit in DefaultRolloverStrategy. (for LOG4J2-1877 by Gary Gregory, Chandra Tungathurthi)

  • Update JAnsi from 1.14 to 1.15. (for LOG4J2-1879 by Gary Gregory)

  • Add missing getters to classes in package org.apache.logging.log4j.core.net.ssl. (for LOG4J2-1899 by Gary Gregory)

  • Update JAnsi from 1.15 to 1.16. (for LOG4J2-1900 by Gary Gregory)

  • Improved error message when misconfigured with multiple incompatible appenders targeting same file. (for LOG4J2-1908 by Remko Popma)

  • Support using java.util.ServiceLoader to locate Log4j 2 API providers. (for LOG4J2-1917 by Ralph Goers)

  • Facilitate log4j use in Android applications: remove dependency on RMI and Management APIs from log4j-api. (for LOG4J2-1926 by Remko Popma)

  • Add support for DirectWriteRolloverStrategy to RollingRandomAccessFileAppender. (for LOG4J2-1928 by Ralph Goers)

  • Update Jackson from 2.8.7 to 2.8.9. (for LOG4J2-1938 by Gary Gregory)

  • Fix docker build with jdk9 requirements (#84). (for LOG4J2-1950 by Gary Gregory, Pierrick HYMBERT)

  • Configurations with multiple root loggers now fail loudly. (for LOG4J2-1954 by Remko Popma)

  • JMS Appender broker password should be a char[], not a String. (for LOG4J2-1956 by Gary Gregory)

  • Deprecate SerializedLayout and remove it as default. (for LOG4J2-1958 by Mikael Ståldal)

  • Disable DTD processing in XML configuration files. (for LOG4J2-1959 by Mikael Ståldal)

  • Update ZeroMQ’s JeroMQ from 0.4.0 to 0.4.1. (for LOG4J2-1960 by Gary Gregory)

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

  • Include separator option of PatternLayout in manual (and other updates). (for LOG4J2-1966 by Gary Gregory, M Sazzadul Hoque)

  • Update HdrHistogram from 2.1.8 to 2.1.9. (for LOG4J2-1970 by Remko Popma)

  • Update ZeroMQ’s JeroMQ from 0.4.1 to 0.4.2. (for LOG4J2-1974 by Gary Gregory)

  • Update javax.persistence from 2.1.0 to 2.1.1. (for LOG4J2-1975 by Gary Gregory)

  • Update org.osgi.core from 4.3.1 to 6.0.0. (for LOG4J2-1976 by Gary Gregory)

  • Allow maxLength of StructuredData to be specified by the user. (for LOG4J2-1984 by Ralph Goers)

  • Refactor SimpleMessage to be concise and clear (#100) (for LOG4J2-1991 by Gary Gregory)

  • Replace JCommander command line parser with picocli to let users run Log4j2 utility applications without requiring an external dependency. (for LOG4J2-2011 by Remko Popma)

  • Allow KeyStoreConfiguration and TrustStoreConfiguration to find files as resources. (for LOG4J2-2015 by Gary Gregory)

  • Update Jackson from 2.8.9 to 2.9.0. (for LOG4J2-2017 by Gary Gregory)

  • Remove default layout from KafkaAppender. (for LOG4J2-2020 by Mikael Ståldal)

  • RFC5424Layout now prints the process id. (for LOG4J2-2022 by Ralph Goers)

  • Use a class' canonical name instead of name to create its logger name. (for LOG4J2-2023 by Gary Gregory)

  • Update SLF4J from 1.7.24 to 1.7.25. (for by Gary Gregory)


  • SocketAppender will lose several events after re-connection to server. (for LOG4J2-1311 by Gary Gregory, Xibing Liang)

  • Prevent NullPointerException when a file name is specified with the DirectWriteRolloverStrategy. (for LOG4J2-1833 by Ralph Goers)

  • Ensure the ThreadLocal StringBuilder in ParameterizedMessage won’t hold excessively much memory after logging a long message. (for LOG4J2-1858 by Remko Popma)

  • Fix configuration documentation. (for LOG4J2-1867 by Mikael Ståldal)

  • More reliable checking for runtime dependencies. (for LOG4J2-1876 by Mikael Ståldal)

  • Fix documentation about default additivity value for loggers. (for LOG4J2-1885 by Matt Sicker)

  • Log4j throws a java.nio.charset.UnsupportedCharsetException: cp65001. (for LOG4J2-1888 by Gary Gregory, Misagh Moayyed)

  • Improve the documentation of the DynamicThresholdFilter. (for LOG4J2-1911 by Ralph Goers)

  • CompositeConfiguration logs warning "Unable to determine URI for configuration." However, the reconfiguration is completed. (for LOG4J2-1912 by Gary Gregory, R Ri)

  • ScriptEngineManager is not available in Android and causes a NoClassDefFoundError. (for LOG4J2-1920 by Gary Gregory, Ajitha)

  • EOFException with FormattedMessage. (for LOG4J2-1929 by Gary Gregory, Borys Sokolov)

  • The eventPrefix attribute was being ignored in the RFC5424Layout. (for LOG4J2-1943 by Ralph Goers)

  • Trim levels read from properties file to remove trailing spaces. (for LOG4J2-1948 by Gary Gregory, Michael Lück)

  • JndiManager is not released when the JmsAppender builder catches an exception trying to build itself. (for LOG4J2-1953 by Gary Gregory)

  • Reconfigure breaks DirectWriteRolloverStrategy. (for LOG4J2-1961 by Gary Gregory, Christian Vent)

  • Dynamic reconfiguration does not work for filePattern of RollingFile. (for LOG4J2-1964 by Gary Gregory, Pierrick HYMBERT)

  • ClassCastException: org.eclipse.osgi.internal.loader.SystemBundleLoader$1 cannot be cast to java.lang.ClassLoader. (for LOG4J2-1971 by Gary Gregory, liwenxian2017)

  • Register log4j-core as an OSGi service. Skip tests for LOG4J2-1766 on macOS. Use group "staff" for LOG4J2-1699 test on macOS. (for LOG4J2-1971 by Ralph Goers)

  • Consider the StringBuilder’s capacity instead of content length when trimming. (for LOG4J2-1977 by Gary Gregory, Jerry xnslong)

  • Log4j-config.xsd only allows one AppenderRef element for each Logger element. (for LOG4J2-1982 by Gary Gregory, Christoph Lembeck)

  • Fix default buffer size to match documentation (from 8102 to 8192 a.k.a. 8KB.) (for LOG4J2-1985 by Gary Gregory, Kenneth McFarland)

  • Log4J JUL Bridge and RMI Security Manager causes access denied ("java.util.logging.LoggingPermission" "control") (for LOG4J2-1987 by Gary Gregory, Andreas Felder)

  • Clarify Javadoc for AbstractTriggeringPolicy. (for LOG4J2-1989 by Gary Gregory, Kenneth McFarland)

  • ConcurrentModificationException logging a parameter of type Map. (for LOG4J2-1990 by Gary Gregory, Philippe Mouawad)

  • Fix compiler warnings in LoggerConfigTest. (for LOG4J2-1993 by Gary Gregory, Kenneth McFarland)

  • TcpSocketServer does not close accepted Sockets. (for LOG4J2-1994 by Gary Gregory)

  • HighlightConverter converts all unrecognized levels to DEBUG. (for LOG4J2-1999 by Gary Gregory, Paul Burrowes)

  • StyleConverter.newInstance argument validation is incorrect. (for LOG4J2-2001 by Gary Gregory, Paul Burrowes)

  • No compression when using a separate drive in Linux. (for LOG4J2-2012 by Gary Gregory, Benjamin Jaton)

  • SslSocketManager does not apply SSLContext on TCP reconnect. (for LOG4J2-2013 by Gary Gregory, Taylor Patton)

  • Mark FileRenameAction as successful when using alternative ways to move files. (for LOG4J2-2016 by Gary Gregory, Benjamin Jaton)

  • Fix incorrect documentation for LoggerNameLevelRewritePolicy. (for LOG4J2-2018 by Remko Popma)

  • Parameter of mdcId in SyslogAppender has no default value. (for LOG4J2-922 by Gary Gregory, angus.aqlu, Paul Burrowes)