Spring Boot Actuator's Trace
does a good job of capturing input/output HTTP params, headers, users, etc. I'd like to expand it to also capture the body of the HTTP response, that way I can have a full view of what is coming in and going out of the the web layer. Looking at the TraceProperties
, doesn't look like there is a way to configure response body capturing. Is there a "safe" way to capture the response body without messing up whatever character stream it is sending back?
相关问题
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- java.lang.IllegalArgumentException: Cannot set to
- Spring Data MongoDB - lazy access to some fields
相关文章
- java JDK动态代理和cglib动态代理最后获取的代理对象都为null的问题
- org.xml.sax.SAXParseException; lineNumber: 7; colu
- SpringMVC如何把File封装到Map中?
- json_encode 没有把数组转为json
- Livy Server: return a dataframe as JSON?
- Spring: controller inheritance using @Controller a
- How to load @Configuration classes from separate J
- Unexpected end of JSON input from an ajax call
Recently, I wrote a blog post about customization of Spring Boot Actuator's
trace
endpoint and while playing with Actuator, I was kinda surprised thatresponse body
isn't one of the supported properties to trace.I thought I may need this feature and came up with a quick solution thanks to Logback's
TeeFilter
.To duplicate output stream of the response, I copied and used TeeHttpServletResponse and TeeServletOutputStream without too much examination.
Then, just like I explained in the blog post, extended
WebRequestTraceFilter
like:Now, you can see
responseBody
in the JSONtrace
endpoint serves.