Support selective ErrorResponse
logging
#30565
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: superseded
An issue that has been superseded by another
type: enhancement
A general enhancement
As a user I would like to be able to easily log any
ErrorResponse
that is returned as response to a web request. This logging allows me to monitor which specific problems are returned and allows easier troubleshooting.It should not matter where the
ErrorResponse
comes from, for instance thrown directly from a controller method, returned in an@ExceptionHandler
(as aErrorResponse
orProblemDetail
), created by theResponseEntityExceptionHandler
, or any other way.I would like to be able to filter which types of problems are logged. For instance, certain input validation problems are probably not interesting to log. Therefor a facility should be provided that allows me to configure which problems should be logged, and which shouldn’t. Preferably I should be able to use Spring environment properties to turn logging on for problems of a specific type (using the
type
field?)I can imagine that not everybody wants to log
ErrorResponse
instances in the same way, for instance some might want different information in the log message or would prefer a specific log marker to be used. Therefor I propose that the code that does the actual logging can easily be replaced by custom logging logic.Some default logging should be provided, and I suggest that the following
ProblemDetail
fields are in the log message:type
,title
,detail
andstatus
.Note: I have discussed this feature request with @rstoyanchev at Spring I/O 2023
The text was updated successfully, but these errors were encountered: