Apache Log4j 2.7 发布了,Log4j是Apache的一个开放源代码项目,通过使用Log4j,我们可以控制日志信息输送的目的地是控制台、文件、GUI组件、甚至是套接口服务 器、NT的事件记录器、UNIX Syslog守护进程等;我们也可以控制每一条日志的输出格式;通过定义每一条日志信息的级别,我们能够更加细致地控制日志的生成过程。最令人感兴趣的就是,这些可以通过一个配置文件来灵活地进行配置,而不需要修改应用的代码。 部分更新内容: 新特性: o LOG4J2-1578: RoutingAppender can be configured with scripts. Add Script in a Routes element. o LOG4J2-1597: Add a ScriptAppenderSelector to create an Appender specified by a Script. o LOG4J2-1349: (GC) Added support for garbage-free ThreadContext map. Disabled by default, users need to enable this explicitly. o LOG4J2-1447: (GC) Changed LogEvent's internal data structure for context data to be garbage-free. Added method LogEvent#getContextData(), deprecated method #getContextMap(). o LOG4J2-1010: Users can now inject context data from other sources than ThreadContext. Values can be any Object, not just Strings. Thanks to Mikael Ståldal. o LOG4J2-1568: Added support for java.util.concurrent.LinkedTransferQueue to AsyncAppender. Bugs 修复: o LOG4J2-1618: Fixed ClassCastException when using JUL logging during shutdown. Thanks to Raman Gupta. o LOG4J2-1620: 2.7-rc1: RollingFileAppender immediateFlush default value should be true, not false. Thanks to Sascha Scholz. o LOG4J2-1611: Improved performance of context data injector for web applications to be on par with standalone applications. o LOG4J2-1591: Introduced new interface LifeCycle2 with stop(long,TimeUnit) method to avoid breaking backwards compatibility with new Configurator.shutdown(LoggerContext, long, TimeUnit) API. o LOG4J2-1590: Fixed issue with filters extending AbstractFilter that did not override methods with unrolled varargs. o LOG4J2-1583: Fixed scrambled log messages triggered by nested logging from toString() method of a logging parameter object. Thanks to Larry West. o LOG4J2-1259: Log4j threads are no longer leaking on Tomcat shutdown. Thanks to Misagh Moayyed, Steffen Offermann. o LOG4J2-1051: When starting on Google App Engine, Interpolator now suppresses the NoClassDefFoundError stack trace for the jvmrunargs lookup. Thanks to Lukasz Lenart. o LOG4J2-1582: When initializing on platforms where JMX is not available, Interpolator component no longer prints stack trace for warning messages. o LOG4J2-1581: Unregistering JMX components no longer prints a stack trace when the MBean has already been unregistered. o LOG4J2-1313: Support Property values to be specified in configuration as a value attribute as well as an element. Thanks to Philipp Knobel, Leon Finker. o LOG4J2-1575: (GC) LoggerConfig now stores configuration properties in a List, not a Map to prevent creating temporary Iterator objects. Added method LoggerConfig#getPropertyList(), deprecated method #getProperties(). o LOG4J2-1457: Fixed class loader deadlock when using async logging and extended stack trace pattern. Thanks to Leon Finker. o LOG4J2-1563: Fix to prevent Log4j 2.6.2 and higher from losing exceptions when a security manager is present. Thanks to Jason Tedor. o LOG4J2-1530: Fixed issue where LogEvent.getContextStack() returned null. o LOG4J2-1518: Prevent deadlock in Async Loggers when queue is full and logged Object's toString() logs another message. Thanks to Leon Finker. o LOG4J2-1542: Prevent ArrayIndexOutOfBoundsException in ParameterizedMessage.formatTo for single-char or empty messages. Thanks to Rogério Lecarião Leite. o LOG4J2-1549: Fixed issue where AsyncLoggerContextSelector+PropertiesConfigurationBuilder defaulted to includeLocation=true. Thanks to Jason Bedard. o LOG4J2-1538: Prevent NPE when dynamically removing filters. Thanks to Igor Karpov. o LOG4J2-1532: Attributes were not merged properly in composite configurations. o LOG4J2-1529: Attributes were not merged properly in composite configurations. Thanks to Sridevi Narra. o LOG4J2-1527: Prevent NPE in RingBufferLogEvent.getFormattedMessage() when used in web applications. Thanks to Jose Leon. o LOG4J2-905: Added ability to disable (date) lookup completely for compatibility with other libraries like Camel. Thanks to Moritz Löser. o LOG4J2-1526: Added support for setting StatusLogger destination in ConfigurationBuilder. o LOG4J2-1448: Allow comma separated agents, host list to be passed to FlumeAppender. Thanks to Keith Laban. o LOG4J2-1500: Merging configurations failed with an NPE when comparing Nodes with different attributes. Thanks to Jose Leon. o LOG4J2-1482: Fixed improper header in CsvParameterLayout. Thanks to Sumit Singhal. o LOG4J2-1199: Documented that JVM Input Arguments Lookup (JMX) is not available on Google App Engine. o LOG4J2-1438: (GC) Added method getParameter() to ObjectMessage (and ReusableObjectMessage). o LOG4J2-1488: (GC) Fixed ISO8601 %date conversion pattern with a period '.' separator for milliseconds is now garbage free. Thanks to Richard Zschech. o LOG4J2-1489: (GC) Fixed %date conversion patterns with a timezone parameter are now garbage free. Thanks to Richard Zschech. o LOG4J2-1279: Prevent NullPointerException in FastDateParser$TimeZoneStrategy. Thanks to Tony Baines. o LOG4J2-1341: (GC) HighlightConverter and StyleConverter are now GC-free. Thanks to Richard Zschech. o LOG4J2-1467: [OSGi] Fixed missing import package. Thanks to Ralf, Gary Gregory. o LOG4J2-351: [OSGi] Fixed wrong Fragment-Host in manifest files. Thanks to Roland Weiglhofer. 变更: o LOG4J2-1604: Log4j2 TcpSocketServer in background. Thanks to Colin Hillman. o LOG4J2-1574: Allow the RollingFileAppender to use default pattern layout. o LOG4J2-1556: Custom Log4j threads now extend Log4jThread. o LOG4J2-1605: Improve error messages for TcpSocketServer and UdpSocketServer. o LOG4J2-1458: Updated Jackson from 2.7.5 to 2.8.0. o LOG4J2-1494: Updated Jackson from 2.8.0 to 2.8.1. o LOG4J2-1569: Updated Jackson from 2.8.1 to 2.8.2. o LOG4J2-1598: Updated Jackson from 2.8.2 to 2.8.3. o LOG4J2-1495: Updated LMAX Disruptor from 3.3.4 to 3.3.5. o LOG4J2-1496: Updated Kafka client from 0.9.1.0 to 0.10.0.0. o LOG4J2-1533: Updated Kafka client from 0.10.0.0 to 0.10.0.1. o LOG4J2-1487: Updated JMS test from ActiveMQ 5.13.3 to 5.13.4. o LOG4J2-1551: Updated JMS test from ActiveMQ 5.13.4 to 5.14.0. o LOG4J2-1543: Removed deprecated Core API org.apache.logging.log4j.core.util.Constants.UTF_8. o LOG4J2-1544: Removed deprecated Core API org.apache.logging.log4j.core.util.Assert.requireNonNull(T, String). o LOG4J2-1545: Removed deprecated Web API org.apache.logging.log4j.web.WebLookup.getServletContext(). 点此查看发行说明 下载地址 http://logging.apache.org/log4j/2.x/download.html Apache Log4j 2.7 发布,Java 日志组件下载地址