How can I log RESTful post data?

前端 未结 3 1328
离开以前
离开以前 2020-12-31 09:18

We have REST services exposed via Spring MVC. We use a HandlerExceptionResolver to log exceptions. We currently log the following:

  • The exception
3条回答
  •  被撕碎了的回忆
    2020-12-31 09:31

    You need a filter that would save request body when it's being read and provide the saved data to your exception logger later.

    Spring contains AbstractRequestLoggingFilter that does the similar thing. Though it's not directly suitable for your problem, you can use it as a reference to implement your own filter.

提交回复
热议问题