question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Async log4j2 log events are not counted accurately

See original GitHub issue

Micrometer provides the Log4j2Metrics meter binder to add metrics for Log4j2 log events. Unfortunately the implementation is flawed. It is implemented as a filter, but filters can be invoked multiple times and must therefore not have any side effects.

In practice the filter is invoked multiple times by Log4j2 in many circumstances (e.g. in the presence of multiple and/or async loggers). The result is that the counter is increased multiple times for each single log event and the counter values become too high.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:22 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
dennysfredericcicommented, Oct 28, 2020

As is not possible to use log4j filters to count log events properly I requested a statistics feature for the log4j team.

With some luck, we can have these counters direct from log4j API.

1reaction
dennysfredericcicommented, Aug 7, 2020

So, let’s became a log4j2 expert 😄

I just started a thread on log4j2 discussion list to see if is possible to use a filter for that use case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Log4j2 asynchronous logging is getting stuck when there is ...
I suspect that your application is producing log events faster than the Appenders can handle. The configuration shows two ConsoleAppenders.
Read more >
Log4j 2 Lock-free Asynchronous Loggers for Low-Latency ...
Asynchronous Loggers are a new addition in Log4j 2. Their aim is to return from the call to Logger.log to the application as...
Read more >
Log4j – Garbage-free Steady State Logging
If your application is multithreaded and logging performance is important, consider using Async Loggers. The ThreadContext map is not garbage- ...
Read more >
Configuring Log4j 2 - Apache Logging Services
</Configuration>. Once an event reaches a logger with its additivity set to false the event will not be passed to any of its...
Read more >
Log4j User Guide (PDF) - Apache Logging Services
Log4j 2 contains next-generation Asynchronous Loggers based on the ... no logging events should match while specifying ALL would mean all ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found