2.7 (2016-10-02)

This release contains several bugfixes and new features. The new features include new logging API modules for Scala 2.10 and 2.11, and support for various non-blocking queue implementations in AsyncAppender. Furthermore the ThreadContext map can now be configured to be garbage-free, and users can now inject context data from other sources than ThreadContext. Context data values can be any Object, not just Strings. More details on the 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.7 API, as well as many core components, maintains binary compatibility with previous releases.

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



  • Users can now inject context data from other sources than ThreadContext. Values can be any Object, not just Strings. (for LOG4J2-1010 by Remko Popma, Mikael Ståldal)

  • Added Logging API for Scala 2.10 and 2.11. (for LOG4J2-1181 by Mikael Ståldal)

  • (GC) Added support for garbage-free ThreadContext map. Disabled by default, users need to enable this explicitly. (for LOG4J2-1349 by Remko Popma)

  • Added optional support for Conversant DisruptorBlockingQueue in AsyncAppender. (for LOG4J2-1430 by Matt Sicker, John Cairns)

  • Added optional support for JCTools MPSC bounded lock-free queue in AsyncAppender. (for LOG4J2-1439 by Matt Sicker, Anthony Maire)

  • (GC) Changed LogEvent’s internal data structure for context data to be garbage-free. Added method LogEvent#getContextData(), deprecated method #getContextMap(). (for LOG4J2-1447 by Remko Popma)

  • [PatternLayout] Add an ANSI option to %message. (for LOG4J2-1458 by Gary Gregory)

  • [PatternLayout] Add an ANSI option to %xThrowable. (for LOG4J2-1471 by Gary Gregory)

  • org.apache.logging.log4j.core.LoggerContext now implements Closeable. (for LOG4J2-1472 by Gary Gregory)

  • FileAppender is now able to create files on-demand. (for LOG4J2-1501 by Gary Gregory)

  • RollingFileAppender is now able to create files on-demand. (for LOG4J2-1504 by Gary Gregory)

  • Create a Builder for the FileAppender plugin to facilitate adding attributes in the future. (for LOG4J2-1505 by Gary Gregory)

  • Allow Builders to be completely generic. (for LOG4J2-1507 by Gary Gregory)

  • Allow a Builder to subclass another Builder. (for LOG4J2-1508 by Gary Gregory)

  • Added options to exclude stack trace from JSON, XML and YAML layouts. (for LOG4J2-1512 by Mikael Ståldal)

  • Add ThreadContextMap2 interface supporting method putAll(Map<String, String>). (for LOG4J2-1516 by Remko Popma, Gary Gregory)

  • Add ThreadContext.putAll(Map<String, String>). (for LOG4J2-1519 by Gary Gregory)

  • Add JUnit Rule implementations to manage the thread context. (for LOG4J2-1520 by Gary Gregory)

  • Added ability to generate Log4j 2-style XML configuration file from ConfigurationBuilder. (for LOG4J2-1528 by Mikael Ståldal)

  • Added Core API Configurator.shutdown(LoggerContext, long, TimeUnit). (for LOG4J2-1539 by Gary Gregory)

  • The Core AbstractManager now tracks its LoggerContext. (for LOG4J2-1540 by Gary Gregory)

  • The Core AbstractConfiguration now tracks its LoggerContext and add Configuration.getLoggerContext(). (for LOG4J2-1547 by Gary Gregory)

  • AbstractManager now implements AutoCloseable. (for LOG4J2-1553 by Gary Gregory)

  • Add a Builder for the SocketAppender (deprecates factory method). (for LOG4J2-1557 by Gary Gregory)

  • SocketAppender now supports IO buffering. (for LOG4J2-1558 by Gary Gregory)

  • Added support for java.util.concurrent.LinkedTransferQueue to AsyncAppender. (for LOG4J2-1568 by Matt Sicker)

  • Add a Builder to the RoutingAppender and deprecate factory method. (for LOG4J2-1577 by Gary Gregory)

  • RoutingAppender can be configured with scripts. Add Script in a Routes element. (for LOG4J2-1578 by Gary Gregory)

  • Add a ScriptAppenderSelector to create an Appender specified by a Script. (for LOG4J2-1597 by Gary Gregory)

  • Add a Builder to ServletAppender and deprecate factory method. (for LOG4J2-1609 by Gary Gregory)


  • Updated Jackson from 2.7.5 to 2.8.0. (for LOG4J2-1458 by Gary Gregory)

  • Updated JMS test from ActiveMQ 5.13.3 to 5.13.4. (for LOG4J2-1487 by Gary Gregory)

  • Updated Jackson from 2.8.0 to 2.8.1. (for LOG4J2-1494 by Gary Gregory)

  • Updated LMAX Disruptor from 3.3.4 to 3.3.5. (for LOG4J2-1495 by Gary Gregory)

  • Updated Kafka client from to (for LOG4J2-1496 by Gary Gregory)

  • Updated Kafka client from to (for LOG4J2-1533 by Gary Gregory)

  • Removed deprecated Core API org.apache.logging.log4j.core.util.Constants.UTF_8. (for LOG4J2-1543 by Gary Gregory)

  • Removed deprecated Core API org.apache.logging.log4j.core.util.Assert.requireNonNull(T, String). (for LOG4J2-1544 by Gary Gregory)

  • Removed deprecated Web API org.apache.logging.log4j.web.WebLookup.getServletContext(). (for LOG4J2-1545 by Gary Gregory)

  • Updated JMS test from ActiveMQ 5.13.4 to 5.14.0. (for LOG4J2-1551 by Gary Gregory)

  • Custom Log4j threads now extend Log4jThread. (for LOG4J2-1556 by Gary Gregory)

  • Updated Jackson from 2.8.1 to 2.8.2. (for LOG4J2-1569 by Gary Gregory)

  • Allow the RollingFileAppender to use default pattern layout. (for LOG4J2-1574 by Gary Gregory)

  • Updated Jackson from 2.8.2 to 2.8.3. (for LOG4J2-1598 by Gary Gregory)

  • Log4j2 TcpSocketServer in background. (for LOG4J2-1604 by Gary Gregory, Colin Hillman)

  • Improve error messages for TcpSocketServer and UdpSocketServer. (for LOG4J2-1605 by Gary Gregory)

  • Update Apache Commons Compress from 1.12 to 1.13. (for LOG4J2-1757 by Gary Gregory)


  • When starting on Google App Engine, Interpolator now suppresses the NoClassDefFoundError stack trace for the jvmrunargs lookup. (for LOG4J2-1051 by Remko Popma, Lukasz Lenart)

  • Documented that JVM Input Arguments Lookup (JMX) is not available on Google App Engine. (for LOG4J2-1199 by Remko Popma)

  • org.apache.logging.log4j.core.appender.routing.IdlePurgePolicy was not working correctly. (for LOG4J2-1235 by Gary Gregory, Niranjan Rao, Sascha Scholz, Aleksey Zvolinsky)

  • Log4j threads are no longer leaking on Tomcat shutdown. (for LOG4J2-1259 by Gary Gregory, Misagh Moayyed, Steffen Offermann)

  • Prevent NullPointerException in FastDateParser$TimeZoneStrategy. (for LOG4J2-1279 by Remko Popma, Tony Baines)

  • Properties declared in configuration can now have their value either in the element body or in an attribute named "value". (for LOG4J2-1313 by Remko Popma, Philipp Knobel)

  • Support Property values to be specified in configuration as a value attribute as well as an element. (for LOG4J2-1313 by Remko Popma, Philipp Knobel, Leon Finker)

  • Support loading custom plugins from jar files and directories whose classpath entries use the "vfs" URL protocol. (for LOG4J2-1320 by Gary Gregory, Paresh Varke, Pierrick Hymbert)

  • (GC) HighlightConverter and StyleConverter are now GC-free. (for LOG4J2-1341 by Remko Popma, Richard Zschech)

  • (GC) Added method getParameter() to ObjectMessage (and ReusableObjectMessage). (for LOG4J2-1438 by Remko Popma)

  • Allow comma separated agents, host list to be passed to FlumeAppender. (for LOG4J2-1448 by Remko Popma, Keith Laban)

  • Fixed class loader deadlock when using async logging and extended stack trace pattern. (for LOG4J2-1457 by Matt Sicker, Leon Finker)

  • [OSGi] Fixed missing import package. (for LOG4J2-1467 by Remko Popma, Gary Gregory, Ralph Goers)

  • Fixed improper header in CsvParameterLayout. (for LOG4J2-1482 by Gary Gregory, Sumit Singhal)

  • (GC) Fixed ISO8601 %date conversion pattern with a period '.' separator for milliseconds is now garbage free. (for LOG4J2-1488 by Remko Popma, Richard Zschech)

  • (GC) Fixed %date conversion patterns with a timezone parameter are now garbage free. (for LOG4J2-1489 by Remko Popma, Richard Zschech)

  • Log4j2 should postpone creating log file until the appender actually receives an event. (for LOG4J2-1490 by Gary Gregory, Krzysztof Taborski)

  • Merging configurations failed with an NPE when comparing Nodes with different attributes. (for LOG4J2-1500 by Gary Gregory, Jose Leon)

  • Fixed issue where CsvParameterLayout and CsvLogEventLayout inserted NUL characters if data starts with {, (, [ or " (for LOG4J2-1502 by Gary Gregory, Sumit Singhal)

  • Log4j should not unregister JMX MBeans when log4j2.disable.jmx property is true. (for LOG4J2-1506 by Gary Gregory, Johannes Schleger)

  • DynamicThresholdFilter filtered incorrectly when params were passed as individual arguments instead of varargs. (for LOG4J2-1511 by Gary Gregory, Srikanth Surukuntu)

  • Prevent deadlock in Async Loggers when queue is full and logged Object’s toString() logs another message. (for LOG4J2-1518 by Remko Popma, Leon Finker)

  • Added support for setting StatusLogger destination in ConfigurationBuilder. (for LOG4J2-1526 by Mikael Ståldal)

  • Prevent NPE in RingBufferLogEvent.getFormattedMessage() when used in web applications. (for LOG4J2-1527 by Remko Popma, Jose Leon)

  • Attributes were not merged properly in composite configurations. (for LOG4J2-1529 by Matt Sicker, Sridevi Narra)

  • Fixed issue where LogEvent.getContextStack() returned null. (for LOG4J2-1530 by Mikael Ståldal)

  • Attributes were not merged properly in composite configurations. (for LOG4J2-1532 by Gary Gregory)

  • Prevent NPE when dynamically removing filters. (for LOG4J2-1538 by Gary Gregory, Igor Karpov)

  • Fix file handle resource leak in XmlConfiguration.XmlConfiguration(ConfigurationSource). (for LOG4J2-1541 by Gary Gregory)

  • Prevent ArrayIndexOutOfBoundsException in ParameterizedMessage.formatTo for single-char or empty messages. (for LOG4J2-1542 by Remko Popma, Rogério Lecarião Leite)

  • [CronTriggeringPolicy] ConfigurationScheduler scheduled the task infinitely after first fire. (for LOG4J2-1548 by Gary Gregory)

  • Fixed issue where AsyncLoggerContextSelector+PropertiesConfigurationBuilder defaulted to includeLocation=true. (for LOG4J2-1549 by Mikael Ståldal, Jason Bedard)

  • Prevent NPE in Level.isInRange. (for LOG4J2-1559 by Gary Gregory, Andrey Plotkin)

  • Prevent SocketAppender memory usage from growing unbounded if it cannot connect to a server. (for LOG4J2-1562 by Gary Gregory)

  • Fix to prevent Log4j 2.6.2 and higher from losing exceptions when a security manager is present. (for LOG4J2-1563 by Gary Gregory, Jason Tedor)

  • Layout is no longer optional. (for LOG4J2-1573 by Gary Gregory, Steffen Offermann)

  • (GC) LoggerConfig now stores configuration properties in a List, not a Map to prevent creating temporary Iterator objects. Added method LoggerConfig#getPropertyList(), deprecated method #getProperties(). (for LOG4J2-1575 by Remko Popma)

  • Unregistering JMX components no longer prints a stack trace when the MBean has already been unregistered. (for LOG4J2-1581 by Remko Popma)

  • When initializing on platforms where JMX is not available, Interpolator component no longer prints stack trace for warning messages. (for LOG4J2-1582 by Remko Popma)

  • Fixed scrambled log messages triggered by nested logging from toString() method of a logging parameter object. (for LOG4J2-1583 by Remko Popma, Larry West)

  • Fixed issue with filters extending AbstractFilter that did not override methods with unrolled varargs. (for LOG4J2-1590 by Remko Popma)

  • Introduced new interface LifeCycle2 with stop(long,TimeUnit) method to avoid breaking backwards compatibility with new Configurator.shutdown(LoggerContext, long, TimeUnit) API. (for LOG4J2-1591 by Remko Popma)

  • Prevent potential NPE in org.apache.logging.log4j.message.ParameterFormatter.formatMessage3(StringBuilder, char[], int, Object[], int, int[]). (for LOG4J2-1599 by Gary Gregory)

  • Prevent potential NPE due to org.apache.logging.log4j.core.layout.MarkerPatternSelector.createSelector(PatternMatch[], String, boolean, boolean, Configuration). (for LOG4J2-1600 by Gary Gregory)

  • Prevent potential NPE due to org.apache.logging.log4j.core.layout.ScriptPatternSelector.createSelector(AbstractScript, PatternMatch[], String, boolean, boolean, Configuration). (for LOG4J2-1601 by Gary Gregory)

  • Prevent potential NPE in org.apache.logging.log4j.core.util.datetime.FormatCache.MultipartKey.equals(Object) when object is null. (for LOG4J2-1602 by Gary Gregory)

  • Redo hashCode() and equals() methods in org.apache.logging.log4j.core.net.ssl classes. (for LOG4J2-1603 by Gary Gregory)

  • ServletAppender does not provide throwable object to ServletContext. (for LOG4J2-1608 by Gary Gregory)

  • Add targetNamespace to log4j-config.xsd. GitHub #43. (for LOG4J2-1610 by Gary Gregory, Shubhankar)

  • Improved performance of context data injector for web applications to be on par with standalone applications. (for LOG4J2-1611 by Remko Popma)

  • Fixed ClassCastException when using JUL logging during shutdown. (for LOG4J2-1618 by Remko Popma, Raman Gupta)

  • new Log4jLogEvent().toString() throws an NPE. (for LOG4J2-1619 by Gary Gregory)

  • 2.7-rc1: RollingFileAppender immediateFlush default value should be true, not false. (for LOG4J2-1620 by Gary Gregory, Sascha Scholz)

  • [OSGi] Fixed wrong Fragment-Host in manifest files. (for LOG4J2-351 by Remko Popma, Gary Gregory, Roland Weiglhofer)

  • Added ability to disable (date) lookup completely for compatibility with other libraries like Camel. (for LOG4J2-905 by Gary Gregory, Moritz Löser)