2

I'm trying to log post requests body on a flask app, like so:

app.logger.error("BODY: %s" % request.data )

I do this because I suspect sometimes I get a malformed JSON object on the POST. The problem I'm seeing is that the logs contain a truncated request body - it just seems cut in the middle..

I can't put a log excerpt because it's sensitive data.. Why is the request truncated? Am I doing this wrong?

Thanks

WeaselFox
  • 7,220
  • 8
  • 44
  • 75
  • possible duplicate of [Get raw POST body in Python Flask regardless of Content-Type header](http://stackoverflow.com/questions/10999990/get-raw-post-body-in-python-flask-regardless-of-content-type-header) – jonafato Jun 21 '15 at 19:11
  • 1
    @jonafato - how is this a duplicate? This has nothing to do with content type, which is always application/json. – WeaselFox Jun 21 '15 at 19:13

1 Answers1

0

Change to app.logger.error("BODY: %s" % request.get_data())

Kevin Martins
  • 590
  • 7
  • 20