Log4j 2.8 发布,Java 日志组件

来源: OSCHINA
编辑: 局长
2017-01-28

Log4j 2.8 发布了。Log4j是Apache的一个开放源代码项目,通过使用Log4j,我们可以控制日志信息输送的目的地是控制台、文件、GUI组件、甚至是套接口服务 器、NT的事件记录器、UNIX Syslog守护进程等;我们也可以控制每一条日志的输出格式;通过定义每一条日志信息的级别,我们能够更加细致地控制日志的生成过程。最令人感兴趣的就 是,这些可以通过一个配置文件来灵活地进行配置,而不需要修改应用的代码。

此版本包含几个错误修复和新功能。新功能包括能够使 RollingFileAppender 日志直接写入到归档文件。

有关新功能和修复的更多详细信息,参见下面:

新特性:

  • LOG4J2-1032: Make DefaultRolloverStrategy more efficent when renaming files. Add nomax option to the fileIndex attribute.

  • LOG4J2-1101:  RollingFileAppender now supports omitting the file name and writing directly to the archive files.

  • LOG4J2-1243:  Allow default value in property to be a Lookup.

  • LOG4J2-1787:  Document how to exclude transitive conflicting dependencies in Maven and Gradle.

  • LOG4J2-1773:  Add StatusLoggerRule to allow unit tests to set a status level.

  • LOG4J2-424:  Add non-string data type support to JdbcAppender via new ColumnMapping plugin.

  • LOG4J2-1771:  Add a Builder to ColumnConfig and deprecate ColumnConfig.createColumnConfig().

  • LOG4J2-1770:  Add a Builder to JdbcAppender and deprecate JdbcAppender.createAppender().

  • LOG4J2-1764:  Use MethodHandle in ContextDataFactory cached constructor.

  • LOG4J2-1730:  Add Apache Cassandra appender and ColumnMapping plugin.

  • LOG4J2-1759:  Add TypeConverter for java.util.UUID.

  • LOG4J2-1758:  Add TypeConverter for java.nio.file.Path.

  • LOG4J2-1755:  Add TypeConverter and constraint validators for java.net.InetAddress and port numbers.

  • LOG4J2-969:  Refactor SyslogAppender so that Layout is a Plugin element.

  • LOG4J2-1660:  Added public method ThreadContext::getThreadContextMap; removed class ThreadContextAccess.

  • LOG4J2-1379:  Add documentation regarding YAML configuration format.

  • LOG4J2-1718:  Introduce marker interface AsynchronouslyFormattable.

  • LOG4J2-1681:  Introduce interfaces IndexedStringMap and IndexedReadOnlyStringMap, supporting garbage-free iteration over sorted map.

  • LOG4J2-1695:  Add a Builder to ScriptPatternSelector and deprecate ScriptPatternSelector.createSelector().

  • LOG4J2-1696:  Add a Builder to MarkerPatternSelector and deprecate MarkerPatternSelector.createSelector().

  • LOG4J2-1697:  Add a SerializerBuilder to PatternLayout and deprecate PatternLayout.createSerializer().

  • LOG4J2-1701:  Add a Builder to RandomAccessFileAppender and deprecate RandomAccessFileAppender.createAppender().

  • LOG4J2-1703:  Add a Builder to MemoryMappedFileAppender and deprecate MemoryMappedFileAppender.createAppender().

  • LOG4J2-1704:  Add a Builder to RollingRandomAccessFileAppender and deprecate RollingRandomAccessFileAppender.createAppender().

  • LOG4J2-1709:  Add a Builder to SyslogAppender and deprecate SyslogAppender.createAppender().

  • LOG4J2-1707:  Allow TCP Socket Appender to set socket options.

  • LOG4J2-1708:  Allow Secure Socket Appender to set socket options.

  • LOG4J2-1737:  Add a Builder to SyslogLayout and deprecate SyslogLayout.createLayout(Facility, boolean, String, Charset).

  • LOG4J2-1738:  Add a Builder to JsonLayout and deprecate org.apache.logging.log4j.core.layout.JsonLayout.createLayout(Configuration, boolean, boolean, boolean, boolean, boolean, boolean, String, String, Charset, boolean).

  • LOG4J2-1739:  Add Builder to KafkaAppender and deprecate KafkaAppender.createAppender(Layout, Filter, String, boolean, String, Property[], Configuration).

  • LOG4J2-1733:  Add SyncSend attribute to KafkaAppender (as in KafkaLog4jAppender). Thanks to Vincent Tieleman.

更新较多,点击发布主页查看更多更新内容

Apache Log4j 2.8 最低需要 Java 7 来构建和运行,Log4j 2.3 是支持 Java 6 的最后一个版本。

下载地址

展开阅读全文
10 收藏
分享
加载中
更多评论
0 评论
10 收藏
分享
返回顶部
顶部