2.6 (2016-05-25)

This is the tenth GA release. It contains several bugfixes and new features. The new features include the ability to be garbage-free (avoid allocating temporary objects) while logging if certain conditions are met, a new YAML Layout, the ability to merge configuration files, and documenting Log4j’s performance against other logging frameworks and in various logging configurations. More details on the features and bugfixes are itemized below.

Note that subsequent to the 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);

Log4j 2.6 maintains binary compatibility with previous releases.

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



  • Document dependencies for layouts. (for LOG4J2-1011 by Mikael Ståldal)

  • Added option to discard events below a certain log level if the async logger ring buffer or async appender queue is full. (for LOG4J2-1080 by Remko Popma)

  • Add JNDI lookup documentation. (for LOG4J2-1133 by Matt Sicker)

  • PatternLayout: Possible variable substitution in equals substitution parameter. (for LOG4J2-1169 by Matt Sicker, Gerald Kritzinger)

  • Documented benchmark results comparing Log4j 2 performance to other logging libraries. (for LOG4J2-1179 by Remko Popma)

  • Dynamic Subject for SMTP Appender. (for LOG4J2-1192 by Gary Gregory, Jörg Bretschneider)

  • PatternLayout option to limit length of text. (for LOG4J2-1217 by Matt Sicker, Thies Wellpott)

  • Added async logger Timeout wait strategy and made this the default wait strategy for async loggers. This prevents a rare deadlock that may occur on Solaris. (for LOG4J2-1221 by Remko Popma, Michael Barker)

  • Make PatternLayout header and footer accept a pattern. (for LOG4J2-1237 by Gary Gregory, Mike Calmus)

  • Make header and footer values customizable in JSONLayout. (for LOG4J2-1244 by Gary Gregory, Remko Popma, Anshu Garg)

  • Make CSV Layout header and footers accept patterns. (for LOG4J2-1245 by Gary Gregory)

  • Add shutdown methods to LogManager. (for LOG4J2-124 by Ralph Goers)

  • JeroMqAppender should support layouts. (for LOG4J2-1252 by Matt Sicker)

  • (GC) Added support for garbage-free logging in steady state. This includes Async Loggers and logging synchronously to the console and to a file, but does not include the AsyncAppender. This release makes the GelfLayout and the main patterns in the PatternLayout garbage-free. (for LOG4J2-1270 by Remko Popma)

  • (GC) Add MessageFactory that avoid allocation by reusing a cached ParameterizedMessage instance. (for LOG4J2-1271 by Remko Popma)

  • (GC) Add encode(LogEvent, ByteBufferDestination) method to Layout API to enable converting LogEvents to bytes without creating temporary objects. (for LOG4J2-1274 by Remko Popma)

  • FormattedMessage, MessageFormatMessage and StringFormattedMessage should support passing in a Locale to ensure appropriate formatting. (for LOG4J2-1277 by Gary Gregory, Ludovic Hochet)

  • (GC) Added unrolled varargs methods to Logger API, added Unbox utility to avoid auto-boxing when logging primitive values. (for LOG4J2-1278 by Remko Popma)

  • (GC) Add interface StringBuilderFormattable to enable converting Messages and parameters to text without allocating temporary objects. ParameterizedMessage, ObjectMessage, SimpleMessage and ThreadDumpMessage now implement StringBuilderFormattable. (for LOG4J2-1293 by Remko Popma)

  • (GC) Added manual page on garbage-free logging. (for LOG4J2-1297 by Remko Popma)

  • Add pattern converter for thread id and priority in PatternLayout. (for LOG4J2-1299 by Gary Gregory)

  • Add documentation links to runtime dependencies in each component intro page. (for LOG4J2-1303 by Matt Sicker)

  • (GC) Added methods to the Logger interface for logging CharSequence messages. (for LOG4J2-1326 by Remko Popma)

  • (GC) FileAppender, RollingFileAppender and MemoryMappedFileAppender are now also garbage-free by default. (for LOG4J2-1344 by Remko Popma)

  • Add an AutoCloseable ThreadContext class: CloseableThreadContext. (for LOG4J2-1348 by Gary Gregory, Greg Thomas)

  • Option to not log stack traces for logged Throwables in GelfLayout. (for LOG4J2-1357 by Mikael Ståldal)

  • Added a YAML layout. (for LOG4J2-1362 by Remko Popma, Gary Gregory)

  • (GC) Update Logger wrapper Generator tool to generate methods for the new Logger methods. (for LOG4J2-1373 by Remko Popma)

  • Support merging configurations to for a composite configuration. (for LOG4J2-494 by Ralph Goers, Philipp Knobel)

  • Pattern to drop first N package parts. (for LOG4J2-621 by Gary Gregory, Lee Theobald, Kamal Mettananda)


  • org.apache.logging.log4j.core.LoggerContext#updateLoggers should call firePropertyChangeEvent. (for LOG4J2-1206 by Matt Sicker)

  • Update SLF4J from 1.7.12 to 1.7.13. (for LOG4J2-1219 by Gary Gregory)

  • Misleading Value In Properties Example. (for LOG4J2-1233 by Gary Gregory, Bahri Gencsoy)

  • Update Jackson from 2.6.3 to 2.6.4. (for LOG4J2-1239 by Gary Gregory)

  • Update Liquibase from 3.3.5 to 3.4.2. (for LOG4J2-1240 by Gary Gregory)

  • Update Jackson from 2.6.4 to 2.7.0. (for LOG4J2-1249 by Gary Gregory)

  • Update LMAX Disruptor from 3.3.2 to 3.3.4. (for LOG4J2-1253 by Gary Gregory)

  • Add enhanced entry and exit methods. (for LOG4J2-1255 by Ralph Goers)

  • (GC) ParameterizedMessage optimizations to avoid or at least postpone allocating temporary objects. (for LOG4J2-1271 by Remko Popma)

  • (GC) Improve LoggerConfig’s data structure for AppenderControl objects to avoid allocating temporary objects during traversal for each log event. (for LOG4J2-1272 by Remko Popma)

  • (GC) Provide ThreadLocal-based gc-free caching mechanism in DatePatternConverter for non-webapps. (for LOG4J2-1283 by Remko Popma)

  • (GC) Update PatternLayout to utilize gc-free mechanism for LogEvent processing. (for LOG4J2-1291 by Remko Popma)

  • (GC) Update RandomAccessFileAppender and RollingRandomAccessFileAppender to utilize gc-free Layout.encode() method. (for LOG4J2-1292 by Remko Popma)

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

  • Remove serializability from classes that don’t need it. (for LOG4J2-1300 by Matt Sicker)

  • Update Jackson from 2.7.0 to 2.7.2. (for LOG4J2-1304 by Gary Gregory)

  • JeroMqAppender should use ShutdownCallbackRegistry instead of runtime hooks. (for LOG4J2-1306 by Matt Sicker)

  • Remove need to pre-specify appender et al. identifiers in property file config format. (for LOG4J2-1308 by Matt Sicker)

  • (GC) Avoid allocating unnecessary temporary objects in LoggerContext’s getLogger methods. (for LOG4J2-1318 by Remko Popma)

  • (GC) Avoid allocating unnecessary temporary objects in PatternLayout’s NamePatternConverter and ClassNamePatternConverter. (for LOG4J2-1321 by Remko Popma)

  • Update Log4j 1.x migration guide to include information about system property lookup syntax changes. (for LOG4J2-1322 by Matt Sicker)

  • (GC) Avoid allocating unnecessary temporary objects in MarkerManager’s getMarker methods. (for LOG4J2-1333 by Remko Popma)

  • (GC) ConsoleAppender is now garbage-free by default. This logic is reusable for all AbstractOutputStreamAppender subclasses. (for LOG4J2-1343 by Remko Popma)

  • (Doc) Clarify documentation for properties that control Log4j behaviour. (for LOG4J2-1345 by Remko Popma)

  • Update Jackson from 2.7.2 to 2.7.3. (for LOG4J2-1351 by Gary Gregory)

  • Update javax.mail from 1.5.4 to 1.5.5. (for LOG4J2-1352 by Gary Gregory)

  • (GC) GelfLayout does now support garbage-free logging (with compressionType=OFF). (for LOG4J2-1356 by Mikael Ståldal)

  • Update Apache Commons Compress from 1.10 to 1.11. (for LOG4J2-1358 by Gary Gregory)

  • (Log4j-internal) Provide message text as CharSequence for some message types to optimize some layouts. (for LOG4J2-1365 by Mikael Ståldal)

  • Migrate tests from Logback 1.1.3 to 1.1.7. (for LOG4J2-1374 by Remko Popma)

  • Update SLF4J from 1.7.13 to 1.7.21. (for LOG4J2-1375 by Remko Popma)

  • Update Jackson from 2.7.3 to 2.7.4. (for LOG4J2-1380 by Gary Gregory)

  • Update Apache Commons CSV from 1.2 to 1.3. (for LOG4J2-1384 by Gary Gregory)

  • Update Google java-allocation-instrumenter from 3.0 to 3.0.1. (for LOG4J2-1388 by Remko Popma)


  • Add a Log4jLookup class to help write log files relative to log4j2.xml. (for LOG4J2-1050 by Matt Sicker, Adam Retter)

  • Fix documentation to specify the correct default wait strategy used by async loggers. (for LOG4J2-1212 by Remko Popma)

  • Documentation/XSD inconsistencies. (for LOG4J2-1215 by Gary Gregory, Erik Kemperman)

  • Creation of a LoggerContext will fail if shutdown is in progress. LogManager will default to SimpleLogger instead. (for LOG4J2-1222 by Ralph Goers)

  • NullPointerException in MapLookup.lookup if the event is null. (for LOG4J2-1227 by Matt Sicker, Olivier Lemasle)

  • Don’t concatenate SYSLOG Messages. (for LOG4J2-1230 by Gary Gregory, Ralph Goers, Vladimir Hudec)

  • Incorrect log rotation in last week of year. (for LOG4J2-1232 by Gary Gregory, Nikolai)

  • org.apache.logging.log4j.core.net.TcpSocketManager and other classes does not report internal exceptions to the status logger. (for LOG4J2-1238 by Gary Gregory)

  • Fixed broken nanotime in pattern layout. (for LOG4J2-1248 by Remko Popma)

  • Fix JUL bridge issue where LogRecord.getParameters() is used when null. (for LOG4J2-1251 by Matt Sicker, Romain Manni-Bucau)

  • Fix typo in Flow Tracing documentation. (for LOG4J2-1254 by Remko Popma, Josh Trow)

  • Async DynamicThresholdFilter does not use the log event’s context map. (for LOG4J2-1258 by Gary Gregory, Francis Lalonde)

  • TlsSyslogFrame calculates message length incorrectly. (for LOG4J2-1260 by Gary Gregory, Blake Day)

  • Stop throwing unnecessary exception in Log4jServletContextListener.contextDestroyed(). (for LOG4J2-1262 by Matt Sicker)

  • The ConfigurationSource was not saved for BuiltConfigurations so monitor interval had no effect. (for LOG4J2-1263 by Ralph Goers)

  • FixedDateFormat was incorrect for formats having MMM with the French locale. (for LOG4J2-1268 by Remko Popma)

  • (GC) AsyncLogger should use thread-local translator by default. (for LOG4J2-1269 by Remko Popma)

  • Fix RollingAppenderNoUnconditionalDeleteTest repeat test runs from failing. (for LOG4J2-1275 by Matt Sicker, Ludovic Hochet)

  • LoggerMessageSupplierTest and LoggerSupplierTest are Locale sensitive. (for LOG4J2-1276 by Gary Gregory, Ludovic Hochet)

  • Deprecate org.apache.logging.log4j.util.MessageSupplier. (for LOG4J2-1280 by Gary Gregory)

  • Logger methods taking Supplier parameters now correctly handle cases where the supplied value is a Message. (for LOG4J2-1280 by Remko Popma)

  • (GC) LoggerConfig.getProperties() should not allocate on each call. (for LOG4J2-1281 by Remko Popma)

  • Made default MessageFactory configurable. (for LOG4J2-1284 by Remko Popma)

  • Change flow logging text from "entry' to "Enter" and "exit" to "Exit". (for LOG4J2-1289 by Gary Gregory)

  • Configuration file error does not show cause exception. (for LOG4J2-1309 by Gary Gregory)

  • JndiLookup mindlessly casts to String and should use String.valueOf(). (for LOG4J2-1310 by Matt Sicker)

  • Improve error handling in the Async Logger background thread: the new default exception handler no longer rethrows the error. (for LOG4J2-1324 by Remko Popma)

  • Fix NoClassDefFoundError in ReflectionUtil on Google App Engine. (for LOG4J2-1330 by Matt Sicker)

  • LoggerFactory in 1.2 API module is not compatible with 1.2. (for LOG4J2-1336 by Gary Gregory, Zbynek Vyskovsky)

  • (Perf) AsyncLogger performance optimization: avoid calling instanceof TimestampMessage in hot path. (for LOG4J2-1339 by Remko Popma)

  • Exception from Log4jServletContextListener prevents jetty-maven-plugin run-forked. (for LOG4J2-1346 by Gary Gregory)

  • No configuration reload is triggered under Windows when replacing the configuration file with one that has older last modified date. (for LOG4J2-1354 by Gary Gregory, Arkadiusz Adolph)

  • Properties Configuration did not support includeLocation attribute on Loggers. (for LOG4J2-1363 by Ralph Goers)

  • (Log4j-internal) StatusLogger dropped exceptions when logging parameterized messages. (for LOG4J2-1368 by Remko Popma)

  • "xz" compression results in plaintext, uncompressed files. (for LOG4J2-1369 by Gary Gregory, Alex Birch)

  • XMLLayout indents, but not the first child tag (Event). (for LOG4J2-1372 by Ralph Goers, Kamal Mettananda)

  • Copying a MutableLogEvent using Log4jLogEvent.Builder should not unnecessarily obtain caller location information. (for LOG4J2-1382 by Remko Popma)

  • Fixed memory leak related to shutdown hook. (for LOG4J2-1387 by Remko Popma)

  • Log4jWebInitializerImpl: Use Thread instead of Class for fallback classloader. (for LOG4J2-248 by Matt Sicker)

  • Generate MDC properties as a JSON map in JSONLayout, with option to output as list of map entries. (for LOG4J2-623 by Remko Popma)

  • JSONLayout doesn’t add a comma between log events. (for LOG4J2-908 by Gary Gregory, Konstantinos Liakos, Patrick Flaherty, Robin Coe)

  • ClassNotFoundException for BundleContextSelector when initialising in an OSGi environment. (for LOG4J2-920 by Matt Sicker, Ludovic Hochet)