Asynchronous Logger in Spring

I have this question, I just throw it there. I am implementing a small logging function for my spring REST API service server to log all requests. I expect 1,000 users to use this API, so with a blocking I / O logger, it will slow everything down. I have two approaches to solving the problem: 1. Have an asynchronous logger using arrylist in memory. then use the spring scheduler to periodically update it to the log file. 2. Use JMS and send logs to the queue. Let the queue process the log asynchronously.

Has anyone done this before using spring. Although I'm for option 2, are there any better ways to do this? Need expert advice. Thanks everyone!

Additional Information. I think synchronized logging will be the bottleneck because this REST API is consumed by the RoR front-end application. Thus, a single user session will definitely result in 100-second API calls very often. I am logging the actual request along with the JSON sent to POST.

+3
source share
2 answers

Has anyone done this before using spring.

Not so weird, yes - Asynchronous Log Using Spring

The article mentions that if you don't want any log events to be lost, JMS would be the way to go - otherwise sticking to Async makes sense to record large volumes.

+3
source

, akka, , JMS .

( ) .

0

All Articles