fishey2 / java-component-template

A template project for Java based projects with Spring Boot 2, Gradle, Logback and JUnit5
MIT License
7 stars 0 forks source link

Implement Logging Middleware for requests and responses #8

Open fishey2 opened 4 years ago

fishey2 commented 4 years ago

This should intercept the requests/responses (HttpServletRequest/Response) and log them out in a readable way.

Example for HttpServletRequest:

{ "message": "RequestFacade {type: POST, endpoint: /message, headers: [ accept: text/plain, application/json, application/*+json, */*, content-type: text/plain;charset=UTF-8, content-length: 12, host: localhost:49703, connection: Keep-Alive, user-agent: Apache-HttpClient/4.5.12 (Java/11.0.4), accept-encoding: gzip,deflate, ], contentType: text/plain;charset=UTF-8, contentLength: 12}" }

Acceptance Criteria:

Given that the Spring App is running When the user calls any unauthenticated endpoint Then the request is logged

Given that the Spring App is running When the user calls any unauthenticated endpoint Then the response to the request is logged