Spring-boot: Enable debug logging for the web logging group when using DevTools

Created on 12 Sep 2018  路  5Comments  路  Source: spring-projects/spring-boot

We disabled devtools logging level tweaks in #14310 but this might have been a bit hasty. Perhaps if there was a warning and a way to opt-out the logging changes would be fine.

enhancement

Most helpful comment

@bclozel The logs are too noisy for me. When I work on the app, 99% of the time I'm interested in my app's logs, not the framework logs. With the default setting, for every request, I see something like that:
2018-09-21 14:06:05.852 DEBUG 14548 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : GET "/hello", parameters={} 2018-09-21 14:06:05.853 DEBUG 14548 --- [nio-8080-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to public java.util.Map<java.lang.String, java.lang.String> com.example.demo.HelloController.hello() 2018-09-21 14:06:05.854 DEBUG 14548 --- [nio-8080-exec-2] m.m.a.RequestResponseBodyMethodProcessor : Using 'application/json;q=0.8', given [text/html, application/xhtml+xml, image/webp, image/apng, application/xml;q=0.9, */*;q=0.8] and supported [application/json, application/*+json, application/json, application/*+json] 2018-09-21 14:06:05.855 DEBUG 14548 --- [nio-8080-exec-2] m.m.a.RequestResponseBodyMethodProcessor : Writing [{msg=hello}] 2018-09-21 14:06:05.857 DEBUG 14548 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Completed 200 OK
I believe there is little value in these logs by default. I don't really need to see the details of request processing, unless something's not right. Specially when your app services a lot of requests, it quickly becomes a mess.

I could also pick on individual entries when the app starts, but it would take too much time to discuss I suppose, and it's less problematic as it happens only once, during app startup. :)

All 5 comments

Hi @philwebb, after upgrading to 2.1.0.M3, is there any way to disable these default DEBUG logs when using devtools? The solution involving modifying logback-spring.xml doesn't work anymore.

@docent The reference documentation was updated with that information in the commit that originally closed this issue. It now says the following:

If you don't want property defaults to be applied you can set
spring.devtools.add-properties to false in your application.properties

@docent Out of curiosity, could you elaborate why you don't want those logs while working on your app? The Spring Framework team worked on reducing a lot the amount and making those more relevant.

If there's something particular that we could improve here, let us know. If it's just something you don't want to see, then Andy's suggestion is the right thing to do.

@bclozel The logs are too noisy for me. When I work on the app, 99% of the time I'm interested in my app's logs, not the framework logs. With the default setting, for every request, I see something like that:
2018-09-21 14:06:05.852 DEBUG 14548 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : GET "/hello", parameters={} 2018-09-21 14:06:05.853 DEBUG 14548 --- [nio-8080-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to public java.util.Map<java.lang.String, java.lang.String> com.example.demo.HelloController.hello() 2018-09-21 14:06:05.854 DEBUG 14548 --- [nio-8080-exec-2] m.m.a.RequestResponseBodyMethodProcessor : Using 'application/json;q=0.8', given [text/html, application/xhtml+xml, image/webp, image/apng, application/xml;q=0.9, */*;q=0.8] and supported [application/json, application/*+json, application/json, application/*+json] 2018-09-21 14:06:05.855 DEBUG 14548 --- [nio-8080-exec-2] m.m.a.RequestResponseBodyMethodProcessor : Writing [{msg=hello}] 2018-09-21 14:06:05.857 DEBUG 14548 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Completed 200 OK
I believe there is little value in these logs by default. I don't really need to see the details of request processing, unless something's not right. Specially when your app services a lot of requests, it quickly becomes a mess.

I could also pick on individual entries when the app starts, but it would take too much time to discuss I suppose, and it's less problematic as it happens only once, during app startup. :)

@docent We've created #14575 to reconsider that. Thanks for your feedback.

Was this page helpful?
0 / 5 - 0 ratings