The Apache Log4j 2 team is pleased to announce the Log4j 2.9 release!
Apache Log4j is a well known framework for logging application behavior. Log4j 2 is an upgrade
to Log4j that provides significant improvements over its predecessor, Log4j 1.x, and provides
many other modern features such as support for Markers, lambda expressions for lazy logging,
property substitution using Lookups, multiple patterns on a PatternLayout and asynchronous
Loggers. Another notable Log4j 2 feature is the ability to be "garbage-free" (avoid allocating
temporary objects) while logging. In addition, Log4j 2 will not lose events while reconfiguring.
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 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:
We do, however, discourage the use of SerializedLayout and recommend JsonLayout as a replacement:
Note that subsequent to the 2.9 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.
GA Release 2.9.0
Changes in this version include:
Support printing multiple StructuredData elements in RFC5424Layout.
Public API for parsing the output from JsonLayout/XmlLayout/YamlLayout into a LogEvent.
JsonLayout, XmlLayout and YamlLayout support 0-byte termination of log events.
Support capped collections for MongoDb appender. Thanks to Matthias Kappeller.
Log4j2 will now print all internal logging to the console if system property `log4j2.debug` is defined with any value (or no value).
Temporary compress directory during rollover (#88). Thanks to Pierrick HYMBERT.
Added wrapper classes CustomLoggerGenerator and ExtendedLoggerGenerator to avoid class name with a dollar ($) character which has special meaning in many unix command line environments.
Added process ID (pid) pattern converter.
Configurable Log File Permissions with PosixFilePermission. Thanks to Demetrios Dimatos, Pierrick HYMBERT.
Generate source jas for all test jars.
JMS Appender does not know how to recover from a broken connection.
JMS Appender should be able connect to a broker (later) even it is not present at configuration time.
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. Thanks to Roman Leventov.
Generic HTTP appender.
Add with(String, primitive) methods to org.apache.logging.log4j.message.MapMessage.
Add forEach() methods to org.apache.logging.log4j.message.MapMessage.
Add containsKey() methods to org.apache.logging.log4j.message.MapMessage.
Support null byte delimiter in GelfLayout. Thanks to Xavier Jodoin.
Add support for Java 9 StackWalker.
Warn when a configuration file for an inactive ConfigurationFactory is found.
Add an optional random delay in TimeBasedTriggeringPolicy Thanks to Anthony Maire.
Shortcut to add Property and KeyValuePair component in ConfigurationBuilder.
The JMS Appender should use a JMS MapMessage for a Log4j MapMessage.
Prevent NullPointerException when a file name is specified with the DirectWriteRolloverStrategy.
Fix incorrect documentation for LoggerNameLevelRewritePolicy.
Parameter of mdcId in SyslogAppender has no default value. Thanks to angus.aqlu, Paul Burrowes.
StyleConverter.newInstance argument validation is incorrect. Thanks to Paul Burrowes.
HighlightConverter converts all unrecognized levels to DEBUG. Thanks to Paul Burrowes.
SslSocketManager does not apply SSLContext on TCP reconnect. Thanks to Taylor Patton, Gary Gregory.
Mark FileRenameAction as successful when using alternative ways to move files. Thanks to Benjamin Jaton.
No compression when using a separate drive in Linux. Thanks to Benjamin Jaton.
Log4j throws a java.nio.charset.UnsupportedCharsetException: cp65001. Thanks to Misagh Moayyed.
ConcurrentModificationException logging a parameter of type Map. Thanks to Philippe Mouawad.
SocketAppender will lose several events after re-connection to server. Thanks to Xibing Liang.
Consider the StringBuilder's capacity instead of content length when trimming. Thanks to Jerry xnslong.
Register log4j-core as an OSGi service. Skip tests for LOG4J2-1766 on MacOS. Use group "staff" for LOG4J2-1699 test on MacOS.
TcpSocketServer does not close accepted Sockets.
Log4J JUL Bridge and RMI Security Manager causes access denied ("java.util.logging.LoggingPermission" "control") Thanks to Andreas Felder.
Log4j-config.xsd only allows one AppenderRef element for each Logger element. Thanks to Christoph Lembeck.
Fix default buffer size to match documentation (from 8102 to 8192 a.k.a. 8KB.) Thanks to Kenneth McFarland.
CompositeConfiguration logs warning "Unable to determine URI for configuration." However, the reconfiguration is completed. Thanks to R Ri.
Dynamic reconfiguration does not work for filePattern of RollingFile. Thanks to Pierrick HYMBERT.
Reconfigure breaks DirectWriteRolloverStrategy. Thanks to Christian Vent.
The eventPrefix attribute was being ignored in the RFC5424Layout.
JndiManager is not released when the JmsAppender builder catches an exception trying to build itself.
Improve the documentation of the DynamicThresholdFilter.
EOFException with FormattedMessage. Thanks to Borys Sokolov.
Trim levels read from properties file to remove trailing spaces. Thanks to Michael Luck.
ClassCastException: org.eclipse.osgi.internal.loader.SystemBundleLoader$1 cannot be cast to java.lang.ClassLoader. Thanks to liwenxian2017.
More reliable checking for runtime dependencies.
Fix configuration documentation.
Ensure the ThreadLocal StringBuilder in ParameterizedMessage won't hold excessively much memory after logging a long message.
Fix documentation about default additivity value for loggers.
ScriptEngineManager is not available in Android and causes a NoClassDefFoundError. Thanks to Ajitha.
Clarify Javadoc for AbstractTriggeringPolicy. Thanks to Kenneth McFarland.
Fix compiler warnings in LoggerConfigTest. Thanks to Kenneth McFarland.
Replaced JCommander with picocli command line parser to let users run Log4j2 utility applications without requiring an external dependency.
Add support for DirectWriteRolloverStrategy to RollingRandomAcessFileAppender.
RFC5424Layout now prints the process id.
Remove default layout from KafkaAppender.
Use a class' canonical name instead of name to create its logger name.
Allow KeyStoreConfiguration and TrustStoreConfiguration to find files as resources.
Allow maxLength of StructuredData to be specified by the user.
Allow for bufferSize=0 in SMTP appender. Thanks to Ben Ludkiewicz, Benjamin Jaton.
Async Loggers no longer use deprecated LMAX Disruptor APIs. (Disruptor-3.3.3 or higher is now required.)
Improved error message when misconfigured with multiple incompatible appenders targeting same file.
Configurations with multiple root loggers now fail loudly.
Deprecate SerializedLayout and remove it as default.
Disable DTD processing in XML configuration files.
Fix docker build with jdk9 requirements (#84). Thanks to Pierrick HYMBERT.
Add more detail to WARN "Ignoring log event" messages printed to the console after log4j was shut down.
Facilitate log4j use in Android applications: remove dependency on RMI and Management APIs from log4j-api.
JMS Appender broker password should be a char, not a String.
Support using java.util.ServiceLoader to locate Log4j 2 API providers.
Include separator option of PatternLayout in manual (and other updates). Thanks to M Sazzadul Hoque.
Move server components from log4j-core to new log4-server module.
Refactor SimpleMessage to be concise and clear (#100) Thanks to .
Update Jackson from 2.8.9 to 2.9.0.
Update ZeroMQ's JeroMQ from 0.3.6 to 0.4.0.
Update ZeroMQ's JeroMQ from 0.4.0 to 0.4.1.
Update ZeroMQ's JeroMQ from 0.4.1 to 0.4.2.
Update Kafka client from 0.10.1.1 to 0.10.2.0
Update Kafka client from 0.10.2.0 to 0.11.0.0
Update JavaMail from 1.5.5 to 1.5.6.
Update JAnsi from 1.14 to 1.15.
Missing documentation for Max index limit in DefaultRolloverStrategy. Thanks to Chandra Tungathurthi.
Add missing getters to classes in package org.apache.logging.log4j.core.net.ssl.
Update JAnsi from 1.15 to 1.16.
Update SLF4J from 1.7.24 to 1.7.25.
Update Jackson from 2.8.7 to 2.8.9.
Update HdrHistogram from 2.1.8 to 2.1.9.
Update javax.persistence from 2.1.0 to 2.1.1.
Update org.osgi.core from 4.3.1 to 6.0.0.
Apache 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 Apache Log4j 2 website: