Skip to content

Fine-tune logging for web requests [SPR-16898] #21437

@spring-projects-issues

Description

@spring-projects-issues

Rossen Stoyanchev opened SPR-16898 and commented

This was originally reported in Spring Boot, ticket #902 but the only way to address it effectively is in the Spring Framework. The below is curated from the original ticket.

current debug output

2014-05-20 09:28:27.058 DEBUG 10695 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet        : DispatcherServlet with name 'dispatcherServlet' processing GET request for [/example]
2014-05-20 09:28:27.058 DEBUG 10695 --- [nio-8080-exec-7] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /example
2014-05-20 09:28:27.059 DEBUG 10695 --- [nio-8080-exec-7] s.w.s.m.m.a.RequestMappingHandlerMapping : Returning handler method [public java.lang.Object project.app.ApplicationController.example()]
2014-05-20 09:28:27.059 DEBUG 10695 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet        : Last-Modified value for [/example] is: -1
2014-05-20 09:28:27.059 DEBUG 10695 --- [nio-8080-exec-7] o.s.w.s.v.ContentNegcodeotiatingViewResolver : Requested media types are [text/html, application/xhtml+xml, image/webp, application/xml;q=0.9, */*;q=0.8] based on Accept header types and producible media types [*/*])
2014-05-20 09:28:27.060 DEBUG 10695 --- [nio-8080-exec-7] o.s.w.s.v.ContentNegotiatingViewResolver : Returning [org.springframework.boot.autoconfigure.groovy.template.web.GroovyTemplateView: unnamed; URL [null]] based on requested media type 'text/html'
2014-05-20 09:28:27.060 DEBUG 10695 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet        : Rendering view [org.springframework.boot.autoconfigure.groovy.template.web.GroovyTemplateView: unnamed; URL [null]] in DispatcherServlet with name 'dispatcherServlet'
2014-05-20 09:28:27.084 DEBUG 10695 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet        : Successfully completed request

There are useful bits on these lines, but there is also a lot of noise. It is hard to find the interesting bits.

Contrast the above debug output with the output below. I think the Rails team has done a nice job of fitting a lot of data on as few of lines as possible in a very readable format.

Started GET "/?foo=bar&baz=bat" for 127.0.0.1 at 2014-05-20 09:44:50 -0400
Processing by StaticController#index as HTML
  Parameters: {"foo"=>"bar", "baz"=>"bat"}
  Rendered static/index.html.erb within layouts/application (0.2ms)
  Rendered shared/_messages.html.erb (0.1ms)
Completed 200 OK in 8ms (Views: 7.7ms | ActiveRecord: 0.0ms)

Also, I really miss the Parameters: {"foo"=>"bar", "baz"=>"bat"} when I'm reading through the org.springframework.web logs.


Affects: 5.0.6

Reference URL: spring-projects/spring-boot#902

This issue is a sub-task of #21485

Issue Links:

0 votes, 7 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: taskA general task

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions