Log4j 2.6 发布,Java 日志组件

来源: OSCHINA
编辑: oschina
2016-05-30

Log4j 2.6 发布了,本次发布的一些新特性:

o LOG4J2-1270:  (GC) Added support for garbage-free logging in steady state.
        This includes Async Loggers and logging synchronously to the console and to a file,
        but does not include the AsyncAppender. This release makes the GelfLayout and
        the main patterns in the PatternLayout garbage-free.
o LOG4J2-1297:  (GC) Added manual page on garbage-free logging.
o LOG4J2-1373:  (GC) Update Logger wrapper Generator tool to generate methods for the new
Logger methods.
o LOG4J2-1326:  (GC) Added methods to the Logger interface for logging CharSequence messages.

o LOG4J2-1344:  (GC) FileAppender, RollingFileAppender and MemoryMappedFileAppender are now
also garbage-free by default.
o LOG4J2-1278:  (GC) Added unrolled varargs methods to Logger API, added Unbox utility to
avoid auto-boxing when logging primitive values.
o LOG4J2-1271:  (GC) Add MessageFactory that avoid allocation by reusing a cached ParameterizedMessage
instance.
o LOG4J2-1293:  (GC) Add interface StringBuilderFormattable to enable converting Messages
and parameters to text without allocating temporary objects.
        ParameterizedMessage, ObjectMessage, SimpleMessage and ThreadDumpMessage now implement
StringBuilderFormattable.
o LOG4J2-1274:  (GC) Add encode(LogEvent, ByteBufferDestination) method to Layout API to enable
converting LogEvents to bytes without creating temporary objects.
o LOG4J2-1362:  Added a YAML layout. Thanks to Gary Gregory.
o LOG4J2-1179:  Documented benchmark results comparing Log4j 2 performance to other logging
libraries.
o LOG4J2-1011:  Document dependencies for layouts.
o LOG4J2-621:  Pattern to drop first N package parts. Thanks to Lee Theobald, Kamal Mettananda,
Gary Gregory.
o LOG4J2-494:  Support merging configurations to for a composite configuration. Thanks to
Philipp Knobel.
o LOG4J2-1357:  Option to not log stack traces for logged Throwables in GelfLayout.
o LOG4J2-1348:  Add an AutoCloseable ThreadContext class: CloseableThreadContext. Thanks to
Greg Thomas, Gary Gregory.
o LOG4J2-1299:  Add pattern converter for thread id and priority in PatternLayout.
o LOG4J2-124:  Add shutdown methods to LogManager.
o LOG4J2-1221:  Added async logger Timeout wait strategy and made this the default wait strategy
for async loggers.
        This prevents a rare deadlock that may occur on Solaris. Thanks to Michael Barker.

o LOG4J2-1080:  Added option to discard events below a certain log level if the async logger
ring buffer
        or async appender queue is full.
o LOG4J2-1237:  Make PatternLayout header and footer accept a pattern. Thanks to Mike Calmus,
Gary Gregory.
o LOG4J2-1244:  Make header and footer values customizable in JSONLayout. Thanks to Anshu
Garg, Remko Popma, Gary Gregory.
o LOG4J2-1245:  Make CSV Layout header and footers accept patterns.
o LOG4J2-1192:  Dynamic Subject for SMTP Appender. Thanks to Jörg Bretschneider, Gary Gregory.

o LOG4J2-1277:  FormattedMessage, MessageFormatMessage and StringFormattedMessage should support
passing in a Locale to ensure appropriate formatting. Thanks to Gary Gregory, Ludovic Hochet.

o LOG4J2-1303:  Add documentation links to runtime dependencies in each component intro page.

o LOG4J2-1252:  JeroMqAppender should support layouts.
o LOG4J2-1217:  PatternLayout option to limit length of text. Thanks to Thies Wellpott.
o LOG4J2-1133:  Add JNDI lookup documentation.
o LOG4J2-1169:  PatternLayout: Possible variable substitution in equals substitution parameter.
Thanks to Gerald Kritzinger.

完整改进记录,可以在这里查看。

展开阅读全文
8 收藏
分享
加载中
最新评论 (11)

引用来自“johnlee007”的评论

已经不用这个了,改用logback了

引用来自“紫电清霜”的评论

why

引用来自“johnlee007”的评论

logback性能更好

引用来自“OSC首席酱油党”的评论

我们都在从logback切到log4j2,性能有一定提高,还有切回去的啊?能分享一下为什么吗?

引用来自“fonture”的评论

因为说改用logback,还没有搞清楚log4j变2了
以为log4j2和log4j是一个东西
2016-05-31 10:28
0
回复
举报

引用来自“johnlee007”的评论

已经不用这个了,改用logback了

引用来自“紫电清霜”的评论

why

引用来自“johnlee007”的评论

logback性能更好

引用来自“OSC首席酱油党”的评论

我们都在从logback切到log4j2,性能有一定提高,还有切回去的啊?能分享一下为什么吗?
因为说改用logback,还没有搞清楚log4j变2了
2016-05-31 10:27
0
回复
举报
搜索一下 AsyncLogger
2016-05-30 17:45
0
回复
举报
你们项目的流量,都大到日志的输出是性能瓶颈的程度了?
如果还没有的话,纠结那么一点点性能差别个毛线啊
2016-05-30 17:07
0
回复
举报

引用来自“johnlee007”的评论

已经不用这个了,改用logback了

引用来自“紫电清霜”的评论

why

引用来自“johnlee007”的评论

logback性能更好
我们都在从logback切到log4j2,性能有一定提高,还有切回去的啊?能分享一下为什么吗?
2016-05-30 10:55
0
回复
举报
这是log4j2,不是log4j
2016-05-30 09:51
0
回复
举报

引用来自“johnlee007”的评论

已经不用这个了,改用logback了

引用来自“紫电清霜”的评论

why
logback性能更好
2016-05-30 09:44
0
回复
举报

引用来自“johnlee007”的评论

已经不用这个了,改用logback了
why
2016-05-30 09:39
0
回复
举报

引用来自“johnlee007”的评论

已经不用这个了,改用logback了
这是log4j2,log4j2,log4j2, 重要的事情说3遍

这个就是logback作者的最新日志框架
2016-05-30 09:35
0
回复
举报
已经不用这个了,改用logback了
2016-05-30 09:20
0
回复
举报
更多评论
11 评论
8 收藏
分享
返回顶部
顶部