misc: don't log payload as is, use repr() so it can be stored (#30558)
This commit is contained in:
parent
70cc7b757b
commit
3f13117021
|
@ -242,7 +242,7 @@ class Request(RequestSession):
|
|||
if self.logger.level == 10: # DEBUG
|
||||
extra['request_headers'] = dict(request.headers.items())
|
||||
if request.body:
|
||||
extra['request_payload'] = repr(request.body)
|
||||
extra['request_payload'] = repr(request.body[:5000])
|
||||
log_function = self.logger.info
|
||||
if response is not None:
|
||||
message = message + ' (=> %s)' % response.status_code
|
||||
|
|
|
@ -152,7 +152,7 @@ class to_json(object):
|
|||
if not self.logger:
|
||||
extras['request'] = req
|
||||
if req.method == 'POST':
|
||||
extras.update({'body': req.body})
|
||||
extras.update({'body': repr(req.body[:5000])})
|
||||
if (not isinstance(e, (Http404, PermissionDenied, ObjectDoesNotExist, RequestException))
|
||||
and getattr(e, 'log_error', True)):
|
||||
logger.exception("Error occurred while processing request", extra=extras)
|
||||
|
|
Loading…
Reference in New Issue