Log server responses of API bad requests in api_json.log
The API helper `render_api_error!` previously would log a 400 error with no details in `api_json.log`, which made it difficult to debug problems in production. To fix this, we: 1. Store the intended status code in the request environment. grape-logging doesn't pass this along to the loggers: https://github.com/aserafin/grape_logging/issues/71 2. In the logger, check the code. If it is 400, attach an `api_error` field that contains the response from the server. Closes https://gitlab.com/gitlab-org/gitlab/-/issues/214879
Showing
Please register or sign in to comment