Store Traces Of Http Requests In Python
Solution 1:
Moved from comment
You could look into https://github.com/getsentry/sentry which is dedicated solution for logging errors. Also it has a way of manually logging data with raven client.
Solution 2:
There are two approaches to do what you want. One is called "tracing", the other "logging".
Tracing means you have some software (like the trace
module) which allows you to create statistics which methods are called how often, what the method parameters are, who calls whom, etc.
With tracing, you need to configure which method/function calls to trace. It's quick to set up but can't look inside of methods/functions. It's a bit dumb.
Also, you'll have to write your own tools to analyze the trace files to make sense of them.
Logging is more manual. You need to configure a logging framework and then call log methods in interesting places. That allows you to see local variables. You can format logical data structures in useful ways, etc.
That means logging is more powerful but takes much more manual work to set up. It will also take some time to learn how to do proper logging (not too much and lot too little). But logging already comes with many powerful tools (log viewers, log file rotation to avoid disk full).
Solution 3:
You can use a middleware to interfere all requests and then log them. Have a look at Rhumbix/django-request-logging for an example implementation.
Post a Comment for "Store Traces Of Http Requests In Python"