在log4j2中计算重复的行数而不是显示所有的行数?[英] Counting repeating lines instead of displaying all of them in log4j2?

本文是小编为大家收集整理的关于在log4j2中计算重复的行数而不是显示所有的行数?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我曾经看到过一个如下的日志.不确定生成了什么日志记录框架.

12:34:56 INFO blah
... previous line repeated 23 times
11:22:33 DEBUG blah

可以使用log4j2?

完成

推荐答案

当前版本log4j 2.6.2没有此功能.我不确定实施此功能有多容易,但是我绝对建议您在 log4j 2问题跟踪器.

可能已经存在类似的请求来抑制重复的堆栈跟踪,但是我认为您的想法足够不同,可以保证单独的JIRA票.

本文地址:https://www.itbaoku.cn/post/1575040.html

问题描述

I have seen a log once that looked like this. Not sure what logging framework generated it.

12:34:56 INFO blah
... previous line repeated 23 times
11:22:33 DEBUG blah

Can this be done with log4j2?

推荐答案

The current version, Log4j 2.6.2, does not have this capability. I'm not sure how easy it would be to implement this, but I would definitely recommend that you raise a feature request for this on the Log4j 2 issue tracker.

A similar request may already exist to suppress repeated stack traces, but I think your idea is different enough to warrant a separate Jira ticket.