I have already introduced my Spring Boot library for synchronous HTTP request/response logging in one of my previous articles Logging with Spring Boot and Elastic Stack. This library is dedicated for synchronous REST applications built with Spring MVC and Spring Web. Since version 5.0 Spring Framework also offers support for reactive REST API through Spring WebFlux project. I decided to extend support for logging in my library to reactive Spring WebFlux.
I have already described some implementation details related to my library
logstash-logging-spring-boot-starter for HTTP request/response logging in one of the previous articles Logging with Spring Boot and Elastic Stack. The article has been published some weeks ago, and since that time some important features has been added to this library. Today I’m going to summarise all those changes and describe all the features provided by the library.
In this article I’ll introduce my library for logging designed especially for Spring Boot RESTful web application. The main assumptions regarding this library are:
- Logging all incoming HTTP requests and outgoing HTTP responses with full body
- Integration with Elastic Stack through Logstash using
- Possibility for enabling logging on a client-side for most commonly used components in Spring Boot application:
- Generating and propagating correlationId across all communication within a single API endpoint call
- Calculating and storing execution time for each request
- A library should be auto-configurable – you don’t have to do anything more than including it as a dependency to your application to make it work