Replies: 1 comment 5 replies
-
It looks like the original |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to pass some custom data to my log records, and I am doing so like this: https://stackoverflow.com/questions/10292082/django-logging-django-request-logger-and-extra-context/
However, when I construct a
rest_framework.request.Request
out of the givenrecord.request
object (Django HttpRequest passed asextra
to thedjango.request
logger), I can't access itsdata
attribute ifrequest.data
has been explicitly accessed by the view that I am logging. If it hasn't been accessed, then no error occurs. When I say "can't" I mean I get aRawPostDataException: You cannot access body after reading from request's data stream
error. Here is the code:Again, if the view that is being logged doesn't access
request.data
, no error occurs.I have also asked a relevant question at SO: https://stackoverflow.com/questions/69437529/cannot-access-request-data-in-log-filter
Any help would be much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions