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 bytes inputstream being consumed can re-read request body multiple times

  • implement , 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

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -