spring boot - How to log request and response (headers+body) using Grails 3? -
i looking ways log incoming request , returned response (headers+body) in grails 3 application. grails has notion of interceptors, in these interceptors unable read body body can read once. if in interceptor normal controller logic fails error indicating stream closed.
i tried find ways on how can done using springboot grails based on springboot.
any hints on how can done in grails 3 application?
i suggest following approach (haven't found available spring-boot when needed similar functionality, i've decided roll own):
implement
httpservletrequestwrapper
copy bytesinputstream
being consumed can re-read request body multiple timesimplement , register
filter
wrap http request on way in , log complete request/response after request consumed , response produced endpoint
nice bonus can log both request , response in 1 logging statement, keeping them in logfile.
Comments
Post a Comment