Skip to content

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

Notifications You must be signed in to change notification settings

NilayaRakesh/RequestIdentifiableLogger-SpringBootAOP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages