Skip to content
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

RestTemplate logging for 404 status code [SPR-12760] #17357

Closed
spring-issuemaster opened this issue Feb 26, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Feb 26, 2015

Gary Russell opened SPR-12760 and commented

I would like to reduce the log level of 404 (NOT FOUND) from WARN to INFO or DEBUG, while still treating it as an error (still have an HttpClientErrorException thrown).

I don't want to set the log level to ERROR because we do want to see WARNs for other errors.

We have added code to XD's admin to clean up rabbitmq using it's REST API. We have to look up several resources to see if they are eligible to be deleted and it is normal that some resource(s) might not be present.

At the moment this causes a bunch of WARN logs to be emitted.

I could, of course, use a custom ResponseErrorHandler and handle 404s differently but that would add a fair amount more complexity to the code.

One solution might be to widen handleResponseError to protected so I can control the logging myself, but I am open to other ideas.


Affects: 4.1.5

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 27, 2015

Juergen Hoeller commented

Let's revisit this for 4.1.6 if it's straightforward, at least allowing for overriding in subclasses, potentially also lowering the default 404 log level to 'debug'.

In general, we are trying to avoid the use of any level higher than 'debug' for per-operation log entries, since those may fill the log rather quickly otherwise.

Juergen

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 27, 2015

Juergen Hoeller commented

It just occured to me that the most general variant would be a protected handleResponse method for both the error and the non-error case, with a unified debug logging statement, and a conditional ResponseErrorHandler invocation at the end. This seems to work fine, and I'm also rather strongly of the opinion that it should be debug level by default, so I've switched that as well.

Juergen

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 27, 2015

Gary Russell commented

Thanks! (no argument from me (DEBUG level) - it means no work for me :) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.