NilayaRakesh / RequestIdentifiableLogger-SpringBootAOP

Adding a request/ log id with all the logs printed for a unique request in SpringBoot using simple annotations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RequestIdentifiableLogger-SpringBootAOP

This project is an example to demonstrate how to attach a uuid with all the logs being printed for one particular request.

Use: To achieve this, the @IdentifiableLogging annotation is created which can be added on any method. All the logs then being printed throughout the execution of that method (and methods called from within that method and so on) will be appended with the same unique log id. Use the custom Logger class IdentifiableLogger for logging.

Here, the annotation has been placed on the controller method, which is the entry point for any request.

Limitations: Since the annotation is based on Spring Aspect Oriented Programming, this will not work if the method on which this annotation is placed is called from another method within the same class.

About

Adding a request/ log id with all the logs printed for a unique request in SpringBoot using simple annotations


Languages

Language:Java 100.0%