_posts/2019-06-30-log4j2-2-12-0-released.html (129 lines of code) (raw):
---
layout: post
status: PUBLISHED
published: true
title: LOG4J2 2.12.0 Released
id: 69011be0-6669-42ee-8ea3-51dcca92a42b
date: '2019-06-30 21:28:54 -0400'
categories: logging
tags: []
permalink: logging/entry/log4j2-2-12-0-released
---
<p>The Apache Log4j 2 team is pleased to announce the Log4j 2.12.0 release!</p>
<p>Apache Log4j is a well known framework for logging application behavior. Log4j 2 is an upgrade<br />
to Log4j that provides significant improvements over its predecessor, Log4j 1.x, and provides<br />
many other modern features such as support for Markers, lambda expressions for lazy logging,<br />
property substitution using Lookups, multiple patterns on a PatternLayout and asynchronous<br />
Loggers. Another notable Log4j 2 feature is the ability to be "garbage-free" (avoid allocating<br />
temporary objects) while logging. In addition, Log4j 2 will not lose events while reconfiguring.</p>
<p>The artifacts may be downloaded from <a href="https://logging.apache.org/log4j/2.x/download.html" rel="nofollow">https://logging.apache.org/log4j/2.x/download.html</a>.</p>
<p>This release contains bugfixes and minor enhancements.</p>
<p>Due to a break in compatibility in the SLF4J binding, Log4j now ships with two versions of the SLF4J to Log4j adapters.<br />
log4j-slf4j-impl should be used with SLF4J 1.7.x and earlier and log4j-slf4j18-impl should be used with SLF4J 1.8.x and<br />
later.</p>
<p>New features include support for reconnfiguration of Log4j configuraton files accessed via HTTP(s) and Spring Cloud<br />
Config specifically, a new Docker Lookup for obtaining information about the current Docker container, new<br />
reconfiguration methods added to the Configurator class, the<br />
ability to pad integers with leading zeros in filenames generated by the rolling file appenders, and allowing the TCP<br />
SocketAppender to connect to mulitple ip addresses when they are returned from DNS.</p>
<p>More details on the new features and fixes are itemized below.</p>
<p>Note that the XML, JSON and YAML formats changed in the 2.11.0 release: they no longer have the "timeMillis" attribute<br />
and instead have an "Instant" element with "epochSecond" and "nanoOfSecond" attributes.</p>
<p>The Log4j 2.12.0 API, as well as many core components, maintains binary compatibility with previous releases.</p>
<h2><a id="user-content-ga-release-2120" class="anchor" aria-hidden="true" href="#ga-release-2120"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>GA Release 2.12.0</h2>
<p>Changes in this version include:</p>
<h3><a id="user-content-new-features" class="anchor" aria-hidden="true" href="#new-features"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>New Features</h3>
<ul>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2403" rel="nofollow">LOG4J2-2403</a>:<br />
Allow zero padding the counter of a RollingFileAppender. Thanks to hupfdule.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2427" rel="nofollow">LOG4J2-2427</a>:<br />
Add filter that will match events when no marker is present. Thanks to Rimaljit Kaur.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2406" rel="nofollow">LOG4J2-2406</a>:<br />
Add reconfiguration methods to Configurator.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-913" rel="nofollow">LOG4J2-913</a>:<br />
Add support for reconfiguration via HTTP(S), Docker, and Spring Cloud Configuration.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2586" rel="nofollow">LOG4J2-2586</a>:<br />
TCP Appender should support a host name resolving to multiple IP addresses.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2337" rel="nofollow">LOG4J2-2337</a>:<br />
Allow custom end-of-line with JsonLayout. Thanks to Arvind Sahare, Patrice Ferrot.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2598" rel="nofollow">LOG4J2-2598</a>:<br />
GZIP compression on rollover supports configurable compression levels. Thanks to Carter Kozak.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2611" rel="nofollow">LOG4J2-2611</a>:<br />
AsyncQueueFullPolicy configuration short values "Default" and "Discard" are case insensitive to avoid confusion.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2634" rel="nofollow">LOG4J2-2634</a>:<br />
Add and use method org.apache.logging.log4j.message.MapMessage.toKey(String) for simpler subclasses.</li>
</ul>
<h3><a id="user-content-fixed-bugs" class="anchor" aria-hidden="true" href="#fixed-bugs"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Fixed Bugs</h3>
<ul>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2547" rel="nofollow">LOG4J2-2547</a>:<br />
RollingRandomAccessFileAppender error message referenced incorrect class name.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2616" rel="nofollow">LOG4J2-2616</a>:<br />
Restore constructor to ThrowablePatternConverter that was removed in 2.8.2.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2622" rel="nofollow">LOG4J2-2622</a>:<br />
StructuredDataId was ignoring maxLength atribute.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2636" rel="nofollow">LOG4J2-2636</a>:<br />
RFC5424Layout was not properly setting default Structured Element id for the MDC</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-1143" rel="nofollow">LOG4J2-1143</a>:<br />
Lookups were not found if the plugin key was not lowercase. Thanks to Pascal Heinrich.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-1852" rel="nofollow">LOG4J2-1852</a>:<br />
Locate plugins within a Jar using a URL Connection. Thanks to Tanner Altares.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2610" rel="nofollow">LOG4J2-2610</a>:<br />
Explicitly set file creation time.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2561" rel="nofollow">LOG4J2-2561</a>:<br />
JEP223 version detection fix for JDK 9 and up. Thanks to Ulrich Enslin.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-1103" rel="nofollow">LOG4J2-1103</a>:<br />
FailoverAppender was failing with ERROR appender Failover has no parameter that matches element Failovers. Thanks to Seán Dunne.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2602" rel="nofollow">LOG4J2-2602</a>:<br />
Update file time when size based triggering policy is used without a time-based triggering policy.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2597" rel="nofollow">LOG4J2-2597</a>:<br />
Throw better exception message when both log4j-slf4j-impl and log4j-to-slf4j are present.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2559" rel="nofollow">LOG4J2-2559</a>:<br />
NullPointerException in JdbcAppender.createAppender(). Thanks to Li Lei, Gary Gregory.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2592" rel="nofollow">LOG4J2-2592</a>:<br />
StackOverflowException when server not reachable with SocketAppender. Thanks to Dávid Kaya, Gary Gregory.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2598" rel="nofollow">LOG4J2-2598</a>:<br />
java.lang.StackOverflowError at org.apache.logging.log4j.junit.AbstractExternalFileCleaner.println(AbstractExternalFileCleaner.java:169). Thanks to Gary Gregory.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2564" rel="nofollow">LOG4J2-2564</a>:<br />
MapPatternConverter is properly created from the '%K', '%map', and '%MAP' patterns.<br />
PatternConverter instanceOf methods with unknown parameter types no longer elide those with known parameters.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2612" rel="nofollow">LOG4J2-2612</a>:<br />
NullPointerException at org.apache.logging.log4j.core.appender.db.jdbc.JdbcDatabaseManager.writeInternal(JdbcDatabaseManager.java:803).</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2618" rel="nofollow">LOG4J2-2618</a>:<br />
Possible ClassCastException in org.apache.logging.log4j.core.script.ScriptManager.ScriptManager(Configuration, WatchManager)</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2631" rel="nofollow">LOG4J2-2631</a>:<br />
RoutingAppender PurgePolicy implementations no longer stop appenders referenced from the logger configuration,<br />
only those that have been created by the RoutingAppender. Note that RoutingAppender.getAppenders no longer<br />
includes entries for referenced appenders, only those which it has created.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2629" rel="nofollow">LOG4J2-2629</a>:<br />
Fix a race allowing events not to be recorded when a RoutingAppender purge policy attempts to delete an idle<br />
appender at exactly the same time as a new event is recorded.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2606" rel="nofollow">LOG4J2-2606</a>:<br />
Asynchronous logging when the queue is full no longer results in heavy CPU utilization and low throughput.</li>
</ul>
<h3><a id="user-content-changes" class="anchor" aria-hidden="true" href="#changes"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Changes</h3>
<ul>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2606" rel="nofollow"></a><br />
Update tests from H2 1.4.197 to 1.4.199. Thanks to Gary Gregory.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2570" rel="nofollow">LOG4J2-2570</a>:<br />
Update Jackson from 2.9.7 to 2.9.8. Thanks to Gary Gregory.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2574" rel="nofollow">LOG4J2-2574</a>:<br />
Update MongoDB 3 module driver from 3.9.0 to 3.10.1. Thanks to Gary Gregory.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2619" rel="nofollow">LOG4J2-2619</a>:<br />
Update Jackson from 2.9.8 to 2.9.9.</li>
<li><a href="https://issues.apache.org/jira/browse/LOG4J2-2634" rel="nofollow">LOG4J2-2634</a>:<br />
Refactor several AsyncLogger methods below the 35 byte threshold for inlining.</li>
</ul>
<hr>
<p>Apache Log4j 2.12.0 requires a minimum of Java 7 to build and run. Log4j 2.3 was the<br />
last release that supported Java 6.</p>
<p>Basic compatibility with Log4j 1.x is provided through the log4j-1.2-api component, however it<br />
does not implement some of the very implementation specific classes and methods. The package<br />
names and Maven groupId have been changed to org.apache.logging.log4j to avoid any conflicts<br />
with log4j 1.x.</p>
<p>For complete information on Apache Log4j 2, including instructions on how to submit bug<br />
reports, patches, or suggestions for improvement, see the Apache Apache Log4j 2 website:</p>
<p><a href="https://logging.apache.org/log4j/2.x/" rel="nofollow">https://logging.apache.org/log4j/2.x/</a></p>