          log_response(
              'Bad request (Unable to parse request body): %s', request.path,
              response=response,
              request=request,
              exc_info=sys.exc_info(),
          )
  
      elif isinstance(exc, BadRequest):
          if settings.DEBUG:
              response = debug.technical_500_response(request, *sys.exc_info(), status_code=400)
 
</s> remove     # response is the result of an exception and is logged at the time the
    # exception is caught so that the exc_info can be recorded.
 </s> add     # response is the result of an exception and is logged when the exception
    # is caught, to record the exception. </s> remove             exc_info=sys.exc_info(),
 </s> add             exception=exc, </s> remove             exc_info=sys.exc_info(),
 </s> add             exception=exc, </s> remove             exc_info=sys.exc_info(),
 </s> add             exception=exc, </s> remove         exc_info=exc_info,
 </s> add         exc_info=exception,
            exception=exc,
          log_response(
              'Bad request (Unable to parse request body): %s', request.path,
              response=response,
              request=request,
            exception=exc,
          )
  
      elif isinstance(exc, BadRequest):
          if settings.DEBUG:
              response = debug.technical_500_response(request, *sys.exc_info(), status_code=400)
keep keep keep keep replace keep keep keep keep keep
 Changed django.utils.log.log_response() to take exception instance.

There's little point retrieving a fresh reference to the exception in
the legacy tuple format, when it's all available via the exception
instance we already have. 
django/core/handlers/exception.py