Unfortunately, I donβt have the code for me right now, but here is how you can solve it (and maybe there will already be a solution).
You can create a new appender that will register asynchronously on your file / console.
In the application, you can implement aggregation yourself. Whenever a login comes in, instead of writing it out immediately, check if you've seen the message before. If you did, instead of logging it, increase your counter.
In the end, convert these aggregated log events to an aggregated message and process it, not your thousands of log events.
This can be resolved (for example) with a second worker on your asynchronous application database. Usually (I look at the lock, but I suppose it will be quite similar to you), asynchronous applications will end up adding events to the queue that will be processed by another thread that runs from this queue.
You may have another queue for your aggregated messages, and the worker who works will say every 5 seconds. If in the same 5 seconds the same message has been viewed several times, your worker can aggregate this message and put it in a queue for processing so that it eventually ends up in the logs.
I hope this helps,
Arthur
PS: As for your configuration, just replace the console appender with your custom aggregation add-on. If you want a console, just extend this appender and do as you want.
source share