days
-1
-4
hours
-2
0
minutes
-3
-7
seconds
-3
-7
search
Upgrade your logging

Apache Log4j 2.12.0: Update for Java logging framework adds new Docker Lookup

Sarah Schlothauer
java
© Shutterstock / Guas

The latest update for the Java-based logging framework Apache Log4j introduces new features, such as allowing custom end-of-line with JsonLayout, support for reconfig of configuraton files accessed via HTTP(s) and Spring Cloud Config, and plenty of bug and issue fixes.

Back in 2014, the Java-based logging framework Log4j upgraded to Log4j2. Log4j2 included a number of improvements, including speed upgrades, a simplified config syntax, fixed architecture issues, and the high-speed LMAX Disruptor.

The updates to this successor continue: Apache announced the latest release on June 30, 2018. Welcome Log4j version 2.12.0.

Let’s see what the newest version entails.

New features & additions

From the changelog, here are the newest features:

SEE ALSO: VS Code introduces a package installer for Java developers

  • LOG4J2-2403: Allow zero padding the counter of a RollingFileAppender. Thanks to hupfdule.
  • LOG4J2-2427: Add filter that will match events when no marker is present. Thanks to Rimaljit Kaur.
  • LOG4J2-2406: Add reconfiguration methods to Configurator.
  • LOG4J2-913: Add support for reconfiguration via HTTP(S), Docker, and Spring Cloud Configuration.
  • LOG4J2-2586: TCP Appender should support a host name resolving to multiple IP addresses.
  • LOG4J2-2337: Allow custom end-of-line with JsonLayout. Thanks to Arvind Sahare, Patrice Ferrot.
  • LOG4J2-2598: GZIP compression on rollover supports configurable compression levels. Thanks to Carter Kozak.
  • LOG4J2-2611: AsyncQueueFullPolicy configuration short values “Default” and “Discard” are case insensitive to avoid confusion.
  • LOG4J2-2634: Add and use method org.apache.logging.log4j.message.MapMessage.toKey(String) for simpler subclasses.

Bug fixes & resolved issues

This update also fixes a list of bugs and issues.

SEE ALSO: How to choose the right Java library

From the changelog:

  • LOG4J2-2547: RollingRandomAccessFileAppender error message referenced incorrect class name.
  • LOG4J2-2616: Restore constructor to ThrowablePatternConverter that was removed in 2.8.2.
  • LOG4J2-2622: StructuredDataId was ignoring maxLength attribute.
  • LOG4J2-2636: RFC5424Layout was not properly setting default Structured Element id for the MDC
  • LOG4J2-1143: Lookups were not found if the plugin key was not lowercase. Thanks to Pascal Heinrich.
  • LOG4J2-1852: Locate plugins within a Jar using a URL Connection. Thanks to Tanner Altares.
  • LOG4J2-2610: Explicitly set file creation time.
  • LOG4J2-2561: JEP223 version detection fix for JDK 9 and up. Thanks to Ulrich Enslin.
  • LOG4J2-1103: FailoverAppender was failing with ERROR appender Failover has no parameter that matches element Failovers. Thanks to Seán Dunne.
  • LOG4J2-2602: Update file time when size based triggering policy is used without a time-based triggering policy.
  • LOG4J2-2597: Throw better exception message when both log4j-slf4j-impl and log4j-to-slf4j are present.
  • LOG4J2-2559: NullPointerException in JdbcAppender.createAppender(). Thanks to Li Lei, Gary Gregory.
  • LOG4J2-2592: StackOverflowException when server not reachable with SocketAppender. Thanks to Dávid Kaya, Gary Gregory.
  • LOG4J2-2598: java.lang.StackOverflowError at org.apache.logging.log4j.junit.AbstractExternalFileCleaner.println(AbstractExternalFileCleaner.java:169). Thanks to Gary Gregory.
  • LOG4J2-2564: MapPatternConverter is properly created from the ‘%K’, ‘%map’, and ‘%MAP’ patterns. PatternConverter instanceOf methods with unknown parameter types no longer elide those with known parameters.
  • LOG4J2-2612: NullPointerException at org.apache.logging.log4j.core.appender.db.jdbc.JdbcDatabaseManager.writeInternal(JdbcDatabaseManager.java:803).
  • LOG4J2-2618: Possible ClassCastException in org.apache.logging.log4j.core.script.ScriptManager.ScriptManager(Configuration, WatchManager)
  • LOG4J2-2631: RoutingAppender PurgePolicy implementations no longer stop appenders referenced from the logger configuration, only those that have been created by the RoutingAppender. Note that RoutingAppender.getAppenders no longer includes entries for referenced appenders, only those which it has created.
  • LOG4J2-2629: Fix a race allowing events not to be recorded when a RoutingAppender purge policy attempts to delete an idle appender at exactly the same time as a new event is recorded.
  • LOG4J2-2606: Asynchronous logging when the queue is full no longer results in heavy CPU utilization and low throughput.

Upgrading

Users require Java 7 or above to build and run this version. Note that Log4j 2 is not compatible with any version of Log4j 1.x.

Upgrade and download the latest version here.

Author
Sarah Schlothauer

Sarah Schlothauer

All Posts by Sarah Schlothauer

Sarah Schlothauer is an assistant editor for JAXenter.com. She received her Bachelor's degree from Monmouth University and is currently enrolled at Goethe University in Frankfurt, Germany where she is working on her Masters. She lives in Frankfurt with her husband and cat.

Leave a Reply

Be the First to Comment!

avatar
400
  Subscribe  
Notify of