2.4.1 (2015-10-08)

This is the ninth GA release. It contains several bugfixes and new features. Log4j 2 requires a minimum of Java 7.

Apache Log4j 2.4.1 requires a minimum of Java 7 to build and run. Log4j 2.4 and greater requires Java 7, version 2.3 required 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.

Changes

Added

  • Add possibility to set shutdown timeout on AsyncAppender. (for LOG4J2-1020 by Mikael Ståldal)

  • Allow PatternLayout to select a pattern to use based on some selection criteria. (for LOG4J2-1129 by Ralph Goers)

  • Add %equals to PatternLayout to test and replace patterns with strings. (for LOG4J2-1145 by Gary Gregory)

  • Add %notEmpty to PatternLayout to avoid output of patterns where all variables are empty. (for LOG4J2-1146 by Gary Gregory)

  • Add %equalsIgnoreCase to PatternLayout to test and replace patterns with strings. (for LOG4J2-1147 by Gary Gregory)

Changed

  • Update MongoDB driver from 2.13.3 to 3.0.4. (for LOG4J2-1040 by Gary Gregory)

  • Reuse StringBuilder to improve performance for String-based layouts: CSV, GELF, HTML, RFC524, Syslog. (for LOG4J2-1128 by Gary Gregory)

  • Update mongo-java-driver from 2.13.2 to 2.13.3. (for LOG4J2-1131 by Gary Gregory)

  • Do not use Jackson deprecated methods. (for LOG4J2-1138 by Gary Gregory)

  • Update Jackson from 2.6.1 to 2.6.2. (for LOG4J2-1139 by Gary Gregory)

  • Update kafka-clients from 0.8.2.1 to 0.8.2.2. (for LOG4J2-1150 by Gary Gregory)

  • Performance improvement: backport Java 8 fast ISO-8859-1 String to byte[] encoder to AbstractStringLayout. (for LOG4J2-1151 by Remko Popma)

  • Performance improvement when converting Strings to byte[] arrays. (for LOG4J2-935 by Remko Popma)

Fixed

  • Fixed Log4jLookup. (for LOG4J2-1050 by Remko Popma)

  • Web site corrections and updates. (for LOG4J2-1126 by Gary Gregory)

  • log4j2.xml cannot be parsed on Oracle Weblogic 12c. (for LOG4J2-1127 by Gary Gregory)

  • Do not use MongoDB driver 2.13.3 deprecated methods. (for LOG4J2-1132 by Gary Gregory)

  • Compression on rollover was broken: log file was renamed to .zip but not compressed. (for LOG4J2-1135 by Remko Popma)

  • Fixed bug where headers were not being written to first file with RollingFileAppender. (for LOG4J2-1140 by Remko Popma)

  • Fix potential memory leak in web applications by using a straight ThreadLocal field instead of subclassing ThreadLocal. (for LOG4J2-1142 by Remko Popma)

  • Add %markerSimpleName in pattern layout should evaluate to marker name (not toString()). (for LOG4J2-1144 by Gary Gregory)

  • Fixed bug where PatternLayout predefined date pattern with time zone always renders default date format. (for LOG4J2-1149 by Remko Popma)

  • Fixed NullPointerException when only root logger is defined (and no named loggers) in configuration properties file. (for LOG4J2-1153 by Remko Popma)