Coder Social home page Coder Social logo

audit-service-interceptor's Introduction

# Logging Request and Response with body in Spring. This project shows a way to log requests and responses in Spring including the body data. More info [here](https://frandorado.github.io/spring/2018/11/15/log-request-response-with-body-spring.html) ## How to test Start the Spring Application ### GET Request Send a GET request `http://localhost:8080/greetings/12` * Response: ``` { "id": 12, "message": "Hello world!" } ``` * Logs: ``` 2018-10-27 16:04:14.302 INFO 88149 --- [nio-8080-exec-2] c.f.l.service.LoggingServiceImpl : REQUEST method=[GET] path=[/greetings/12] headers=[{cookie=JSESSIONID=lqPKUYOnoisYTVVqsDxsmZWszZ0W_pCfobhBSut0, postman-token=0d2ab740-1745-457e-be51-ad4c171422b8, host=localhost:8080, connection=keep-alive, cache-control=no-cache, accept-encoding=gzip, deflate, user-agent=PostmanRuntime/7.3.0, accept=*/*}] 2018-10-27 16:04:14.383 INFO 88149 --- [nio-8080-exec-2] c.f.l.service.LoggingServiceImpl : RESPONSE method=[GET] path=[/greetings/12] responseHeaders=[{}] responseBody=[GreetingResponse(id=12, message=Hello world!)] ``` ### POST Request Send a POST request `http://localhost:8080/greetings` * Request body: ``` { "message": "Hello Java world!" } ``` * Response body: ``` { "id": "1", "message": "Hello Java world!" } ``` * Logs: ``` 2018-10-27 16:17:28.913 INFO 88149 --- [nio-8080-exec-5] c.f.l.service.LoggingServiceImpl : REQUEST method=[POST] path=[/greetings] headers=[{content-length=38, cookie=JSESSIONID=lqPKUYOnoisYTVVqsDxsmZWszZ0W_pCfobhBSut0, postman-token=d3957f0e-4dd7-4ae0-aaca-44febc487a22, host=localhost:8080, content-type=application/json, connection=keep-alive, cache-control=no-cache, accept-encoding=gzip, deflate, user-agent=PostmanRuntime/7.3.0, accept=*/*}] body=[GreetingRequest(message=Hello Java world!)] 2018-10-27 16:17:28.918 INFO 88149 --- [nio-8080-exec-5] c.f.l.service.LoggingServiceImpl : RESPONSE method=[POST] path=[/greetings] responseHeaders=[{}] responseBody=[GreetingResponse(id=1, message=Hello Java world!)] ``` # audit-service-interceptor

audit-service-interceptor's People

Watchers

dokter web avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.