title: Spring Boot error controller retrieve original request
body: <p>By default Spring Boot maps <code>/error</code> to <code>BasicErrorController</code>. I want to log the exception along with the request that causes the exception. How can I get the original request in <code>BasicErrorController</code> or a new <code>CustomErrorController</code>. It seems that Spring Boot will make a new request to <code>/error</code> when an exception is thrown and the orginal request info is gone or no way to map the error with the original request.
  <a href="https://i.stack.imgur.com/6AvN7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6AvN7.png" alt="enter image description here"></a></p>