Spring boot incoming request debugging/logging
ExecStart=/usr/bin/java -Ddebug=true -Dtrace=true -Dspring.profiles.active=staging -Dserver.port=8085 -Dlogging.level.org.springframework.web=DEBUG -Dspring.http.log-request-details=true -jar /etc/www-api/micropub.jar --debug
AbstractRequestLoggingFilter
https://www.baeldung.com/spring-http-logging
-Ddebug
:
{"@version":1,"source_host":"MajesticMoose","message":"GET \"/apis\", parameters={}","thread_name":"http-nio-8080-exec-4","@timestamp":"2021-12-19T11:19:48.886+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.DispatcherServlet"}
{"@version":1,"source_host":"MajesticMoose","message":"Mapped to uk.gov.api.springboot.controllers.MetadataController#retrieveAll()","thread_name":"http-nio-8080-exec-4","@timestamp":"2021-12-19T11:19:48.887+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"}
{"@version":1,"source_host":"MajesticMoose","message":"Using 'application/vnd.uk.gov.api.v1alpha+json', given [*/*] and supported [application/vnd.uk.gov.api.v1alpha+json]","thread_name":"http-nio-8080-exec-4","@timestamp":"2021-12-19T11:19:48.887+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor"}
{"@version":1,"source_host":"MajesticMoose","message":"Writing [models.metadata.BulkMetadataResponse@6f2ffd1e[apiVersion=<null>,apis=[],additionalProperties={}]]","thread_name":"http-nio-8080-exec-4","@timestamp":"2021-12-19T11:19:48.887+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor"}
{"@version":1,"source_host":"MajesticMoose","message":"Completed 200 OK","thread_name":"http-nio-8080-exec-4","@timestamp":"2021-12-19T11:19:48.888+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.DispatcherServlet"}
{"@version":1,"source_host":"MajesticMoose","message":"POST \"/apis\", parameters={masked}","thread_name":"http-nio-8080-exec-2","@timestamp":"2021-12-19T11:26:14.168+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.DispatcherServlet"}
{"@version":1,"source_host":"MajesticMoose","message":"Mapped to uk.gov.api.springboot.controllers.MetadataController#post___()","thread_name":"http-nio-8080-exec-2","@timestamp":"2021-12-19T11:26:14.168+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"}
{"@version":1,"source_host":"MajesticMoose","message":"Using 'application/vnd.uk.gov.api.v1alpha+json', given [*/*] and supported [application/vnd.uk.gov.api.v1alpha+json]","thread_name":"http-nio-8080-exec-2","@timestamp":"2021-12-19T11:26:14.169+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor"}
{"@version":1,"source_host":"MajesticMoose","message":"Writing [models.metadata.BulkMetadataResponse@2caf5806[apiVersion=api.gov.uk/v1alpha,apis=[],additionalProper (truncated)...]","thread_name":"http-nio-8080-exec-2","@timestamp":"2021-12-19T11:26:14.169+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor"}
{"@version":1,"source_host":"MajesticMoose","message":"Completed 200 OK","thread_name":"http-nio-8080-exec-2","@timestamp":"2021-12-19T11:26:14.171+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.DispatcherServlet"}
-Dtrace
{"@version":1,"source_host":"MajesticMoose","message":"Bound request context to thread: org.apache.catalina.connector.RequestFacade@18ef151","thread_name":"http-nio-8080-exec-2","@timestamp":"2021-12-19T11:27:33.956+0000","level":"TRACE","logger_name":"org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter"}
{"@version":1,"source_host":"MajesticMoose","message":"GET \"/apis\", parameters={}, headers={masked} in DispatcherServlet 'dispatcherServlet'","thread_name":"http-nio-8080-exec-2","@timestamp":"2021-12-19T11:27:33.956+0000","level":"TRACE","logger_name":"org.springframework.web.servlet.DispatcherServlet"}
{"@version":1,"source_host":"MajesticMoose","message":"Returning cached instance of singleton bean 'metadataController'","thread_name":"http-nio-8080-exec-2","@timestamp":"2021-12-19T11:27:33.957+0000","level":"TRACE","logger_name":"org.springframework.beans.factory.support.DefaultListableBeanFactory"}
{"@version":1,"source_host":"MajesticMoose","message":"Mapped to uk.gov.api.springboot.controllers.MetadataController#retrieveAll()","thread_name":"http-nio-8080-exec-2","@timestamp":"2021-12-19T11:27:33.957+0000","level":"TRACE","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"}
{"@version":1,"source_host":"MajesticMoose","message":"Arguments: []","thread_name":"http-nio-8080-exec-2","@timestamp":"2021-12-19T11:27:33.957+0000","level":"TRACE","logger_name":"org.springframework.web.method.HandlerMethod"}
{"@version":1,"source_host":"MajesticMoose","message":"Using 'application/vnd.uk.gov.api.v1alpha+json', given [*/*] and supported [application/vnd.uk.gov.api.v1alpha+json]","thread_name":"http-nio-8080-exec-2","@timestamp":"2021-12-19T11:27:33.957+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor"}
{"@version":1,"source_host":"MajesticMoose","message":"Writing [models.metadata.BulkMetadataResponse@32380595[apiVersion=<null>,apis=[],additionalProperties={}]]","thread_name":"http-nio-8080-exec-2","@timestamp":"2021-12-19T11:27:33.958+0000","level":"TRACE","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor"}
{"@version":1,"source_host":"MajesticMoose","message":"Applying default cacheSeconds=-1","thread_name":"http-nio-8080-exec-2","@timestamp":"2021-12-19T11:27:33.959+0000","level":"TRACE","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"}
{"@version":1,"source_host":"MajesticMoose","message":"No view rendering, null ModelAndView returned.","thread_name":"http-nio-8080-exec-2","@timestamp":"2021-12-19T11:27:33.959+0000","level":"TRACE","logger_name":"org.springframework.web.servlet.DispatcherServlet"}
{"@version":1,"source_host":"MajesticMoose","message":"Completed 200 OK, headers={masked}","thread_name":"http-nio-8080-exec-2","@timestamp":"2021-12-19T11:27:33.959+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.DispatcherServlet"}
{"@version":1,"source_host":"MajesticMoose","message":"Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@18ef151","thread_name":"http-nio-8080-exec-2","@timestamp":"2021-12-19T11:27:33.959+0000","level":"TRACE","logger_name":"org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter"}
{"@version":1,"source_host":"MajesticMoose","message":"Bound request context to thread: org.apache.catalina.connector.RequestFacade@18ef151","thread_name":"http-nio-8080-exec-3","@timestamp":"2021-12-19T11:27:46.475+0000","level":"TRACE","logger_name":"org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter"}
{"@version":1,"source_host":"MajesticMoose","message":"POST \"/apis\", parameters={masked}, headers={masked} in DispatcherServlet 'dispatcherServlet'","thread_name":"http-nio-8080-exec-3","@timestamp":"2021-12-19T11:27:46.476+0000","level":"TRACE","logger_name":"org.springframework.web.servlet.DispatcherServlet"}
{"@version":1,"source_host":"MajesticMoose","message":"Returning cached instance of singleton bean 'metadataController'","thread_name":"http-nio-8080-exec-3","@timestamp":"2021-12-19T11:27:46.476+0000","level":"TRACE","logger_name":"org.springframework.beans.factory.support.DefaultListableBeanFactory"}
{"@version":1,"source_host":"MajesticMoose","message":"Mapped to uk.gov.api.springboot.controllers.MetadataController#post___()","thread_name":"http-nio-8080-exec-3","@timestamp":"2021-12-19T11:27:46.476+0000","level":"TRACE","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"}
{"@version":1,"source_host":"MajesticMoose","message":"Arguments: []","thread_name":"http-nio-8080-exec-3","@timestamp":"2021-12-19T11:27:46.476+0000","level":"TRACE","logger_name":"org.springframework.web.method.HandlerMethod"}
{"@version":1,"source_host":"MajesticMoose","message":"Using 'application/vnd.uk.gov.api.v1alpha+json', given [*/*] and supported [application/vnd.uk.gov.api.v1alpha+json]","thread_name":"http-nio-8080-exec-3","@timestamp":"2021-12-19T11:27:46.477+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor"}
{"@version":1,"source_host":"MajesticMoose","message":"Writing [models.metadata.BulkMetadataResponse@64c69ec7[apiVersion=api.gov.uk/v1alpha,apis=[],additionalProperties={}]]","thread_name":"http-nio-8080-exec-3","@timestamp":"2021-12-19T11:27:46.477+0000","level":"TRACE","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor"}
{"@version":1,"source_host":"MajesticMoose","message":"Applying default cacheSeconds=-1","thread_name":"http-nio-8080-exec-3","@timestamp":"2021-12-19T11:27:46.478+0000","level":"TRACE","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"}
{"@version":1,"source_host":"MajesticMoose","message":"No view rendering, null ModelAndView returned.","thread_name":"http-nio-8080-exec-3","@timestamp":"2021-12-19T11:27:46.478+0000","level":"TRACE","logger_name":"org.springframework.web.servlet.DispatcherServlet"}
{"@version":1,"source_host":"MajesticMoose","message":"Completed 200 OK, headers={masked}","thread_name":"http-nio-8080-exec-3","@timestamp":"2021-12-19T11:27:46.478+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.DispatcherServlet"}
{"@version":1,"source_host":"MajesticMoose","message":"Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@18ef151","thread_name":"http-nio-8080-exec-3","@timestamp":"2021-12-19T11:27:46.478+0000","level":"TRACE","logger_name":"org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter"}
-Dlogging.level.org.springframework.web=DEBUG
for quieter debug
-Dlogging.level.org.springframework.web=DEBUG -Dspring.mvc.log-request-details=true
https://stackoverflow.com/a/55679297
WIP: Not headers
{"@version":1,"source_host":"MajesticMoose","message":"POST \"/apis\", parameters={foo:[bar]}","thread_name":"http-nio-8080-exec-4","@timestamp":"2021-12-19T11:34:31.072+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.DispatcherServlet"}
{"@version":1,"source_host":"MajesticMoose","message":"Mapped to uk.gov.api.springboot.controllers.MetadataController#post___()","thread_name":"http-nio-8080-exec-4","@timestamp":"2021-12-19T11:34:31.072+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"}
{"@version":1,"source_host":"MajesticMoose","message":"Using 'application/vnd.uk.gov.api.v1alpha+json', given [*/*] and supported [application/vnd.uk.gov.api.v1alpha+json]","thread_name":"http-nio-8080-exec-4","@timestamp":"2021-12-19T11:34:31.073+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor"}
{"@version":1,"source_host":"MajesticMoose","message":"Writing [models.metadata.BulkMetadataResponse@77ce2f6a[apiVersion=api.gov.uk/v1alpha,apis=[],additionalProper (truncated)...]","thread_name":"http-nio-8080-exec-4","@timestamp":"2021-12-19T11:34:31.073+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor"}
{"@version":1,"source_host":"MajesticMoose","message":"Completed 200 OK","thread_name":"http-nio-8080-exec-4","@timestamp":"2021-12-19T11:34:31.074+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.DispatcherServlet"}
{"@version":1,"source_host":"MajesticMoose","message":"POST \"/apis\", parameters={foo:[bar]}","thread_name":"http-nio-8080-exec-6","@timestamp":"2021-12-19T11:34:40.071+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.DispatcherServlet"}
{"@version":1,"source_host":"MajesticMoose","message":"Mapped to uk.gov.api.springboot.controllers.MetadataController#post___()","thread_name":"http-nio-8080-exec-6","@timestamp":"2021-12-19T11:34:40.072+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"}
{"@version":1,"source_host":"MajesticMoose","message":"Using 'application/vnd.uk.gov.api.v1alpha+json', given [*/*] and supported [application/vnd.uk.gov.api.v1alpha+json]","thread_name":"http-nio-8080-exec-6","@timestamp":"2021-12-19T11:34:40.072+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor"}
{"@version":1,"source_host":"MajesticMoose","message":"Writing [models.metadata.BulkMetadataResponse@63035a54[apiVersion=api.gov.uk/v1alpha,apis=[],additionalProper (truncated)...]","thread_name":"http-nio-8080-exec-6","@timestamp":"2021-12-19T11:34:40.072+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor"}
{"@version":1,"source_host":"MajesticMoose","message":"Completed 200 OK","thread_name":"http-nio-8080-exec-6","@timestamp":"2021-12-19T11:34:40.073+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.DispatcherServlet"}
not JSON
{"@version":1,"source_host":"MajesticMoose","message":"POST \"/apis\", parameters={}","thread_name":"http-nio-8080-exec-3","@timestamp":"2021-12-19T11:36:23.158+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.DispatcherServlet"}
{"@version":1,"source_host":"MajesticMoose","message":"Mapped to uk.gov.api.springboot.controllers.MetadataController#post___()","thread_name":"http-nio-8080-exec-3","@timestamp":"2021-12-19T11:36:23.159+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"}
{"@version":1,"source_host":"MajesticMoose","message":"Using 'application/vnd.uk.gov.api.v1alpha+json', given [*/*] and supported [application/vnd.uk.gov.api.v1alpha+json]","thread_name":"http-nio-8080-exec-3","@timestamp":"2021-12-19T11:36:23.159+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor"}
{"@version":1,"source_host":"MajesticMoose","message":"Writing [models.metadata.BulkMetadataResponse@725c02ef[apiVersion=api.gov.uk/v1alpha,apis=[],additionalProper (truncated)...]","thread_name":"http-nio-8080-exec-3","@timestamp":"2021-12-19T11:36:23.160+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor"}
{"@version":1,"source_host":"MajesticMoose","message":"Completed 200 OK","thread_name":"http-nio-8080-exec-3","@timestamp":"2021-12-19T11:36:23.160+0000","level":"DEBUG","logger_name":"org.springframework.web.servlet.DispatcherServlet"}
Edited by Jamie Tanna