Skip to content

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

@spring-projects-issues

Description

@spring-projects-issues

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

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions