Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Django middleware/plugin that logs all my requests in a organized fashion? [closed]

I want to log every request that ever comes through my sever. Is there a plugin/middleware for this?

Ideally I'd like it to be queryable.

like image 345
TIMEX Avatar asked Jan 29 '11 20:01

TIMEX


People also ask

What is Get_response in Django middleware?

get_response(request) # Code to be executed for each request/response after # the view is called. return response. The get_response callable provided by Django might be the actual view (if this is the last listed middleware) or it might be the next middleware in the chain.

What can be achieved using middleware in Django?

In Django, middleware is a lightweight plugin that processes during request and response execution. Middleware is used to perform a function in the application. The functions can be a security, session, csrf protection, authentication etc.

Can we create custom middleware in Django?

Custom middleware in Django is created either as a function style that takes a get_response callable or a class-based style whose call method is used to process requests and responses. It is created inside a file middleware.py . A middleware is activated by adding it to the MIDDLEWARE list in Django settings.

Is middleware a decorator?

Middleware and decorators are similar and can do the same job. They provide a means of inserting intermediary effects either before or after other effects downstream in the chain/stack.


2 Answers

Don't know if that's what you want, but django-sentry is a great app for logging errors that occur in your Django site. They can be shown in a (well-designed!) web interface, allowing for sorting like number of occurrences of an error etc.

If you just want to log requests, Apache's access.log should be enough. And I guess there are many tools for parsing and displaying the content of Apache logs.

like image 93
AndiDog Avatar answered Oct 11 '22 06:10

AndiDog


You best bet seems to be django-request.

like image 24
shanyu Avatar answered Oct 11 '22 08:10

shanyu