-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Log each web request: DEBUG = too much, INFO = too little #902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Unfortunately all the logging is happening at a level below Spring Boot. Maybe we could collect some useful settings and curate them for you into a single Boot config flag. You could help by identifying the subset of real DEBUG log statements that you do find useful (ass opposed to the fantasy of what you might ideally like). Or there's this really useful thing called "grep". |
First off, only the 1st request has ~20 lines. The 2nd request to an endpoint only has 8 lines. current debug output
There are useful bits on these lines, but there is also a lot of noise. It is hard to find the interesting bits. As for grep, I'd rather the output be curated to show me the information that I'm interested in seeing. The 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.
Also, I really miss the |
So if you just switch off the DEBUG logging for the |
@dsyer My example is a basic out-of-the-box experience. As for security access decisions and other important log items, I'll follow up with useful examples. It might be worth removing |
If you want to improve the logging of |
@philwebb I think this is a good candidate for spring-boot-devtools. I've found myself implementing a hack of AbstractRequestLoggingFilter for development debugging of requests/responses for each SB project I've been on. I don't really like the solution I come up with each time, and wish there were something better out of the box. My use case is starting up the SB app, opening my front-end app (web or mobile), and seeing the request parameters/body in the log, and the response body with its status code. This helps me quickly debug that I'm sending the right params, and that Spring is parsing them correctly. The response output helps me to understand the actual output my client should expect. The response status code is important, but the response body is also very important. Dev tools should be able to enable this by default, but remove it in production. Although, there is a case to be made that this would be valuable in an acceptance (pre-production) environment to help with debugging. |
How about sharing what you've done so far and we can see what we can do to integrate it? I am more in the camp of implementing a feature that can be controlled via properties and have Devtools switch that on for you. That's how we implemented the H2 console support and this proved to be quite effective. Looking for your PR then! |
we had a request from a customer who is passing GPS data into applications via the URL - if we could have a way to redact parts of those logs. Could be worth investigating a regex redactor? |
That sounds crazy to me (and not at all related to this issue, which is about dev time). |
Logback already has support for regex-based filtering of log events. Alternatively, if you really wanted to implement redaction you could use a custom layout. Neither belongs in Spring Boot, though. |
This doesn't seem to have really gone anywhere and we still believe that this would be better tackled outside of Spring Boot where it could benefit all Spring users. |
This can only be addressed properly in the Spring Framework, so I've created SPR-16898. |
Logging for web-mvc controller requests or static files should appears with the HTTP method and path. This will make debugging easier in production and development environments.
INFO = 3 log lines with no useful information
DEBUG = 30 log lines, with little useful information
Expectation:
The text was updated successfully, but these errors were encountered: