This project has three main goals => Logging with AOP, processing asynchronous and thread safe.
Outputs are located at the bottom of the page.
Cause I want to get log parameter when before the method return and i want get log return type when after returning. (with timestamp)
I use AspectJ for that. (@Before and @AfterReturning)
Cause If I want to ignore parameter or return type for log, I can add a value of annotation and DONE!
So I added ignoreparam and ignorereturn values for the annotation. Aspect is wired to the annotation.
Maybe asynchronous logging is not good idea for this project but this is only demo.
I used GitHub API for getting users. Threads are working in asynchronous. Also Aspect Logger doing the job in asynchronous.
Logger and RestTemplate defined final for thread safe. Threads are getting in Thread Pool (threadPoolTaskExecutor).
This annotations target is method level and works runtime.
ignorereturn is default false and ignoreparam is default empty string.
Defined pointcut for annotation. Getting parameter name and annotation with reflection and joinpoint.
Then checking string in the service methods parameter and getting logs. Same thing for the return type.
This one has parameter name and return type. You can see the asynchronous threads. They are working diffrent order.
This one has ignoreparam and ignorereturn values. Same processes are asynchronous again but log is not getting return type and parameter.