Search code examples
djangodjango-middlewaredjango-logging

Django Logger vs Logging Middleware


I want to log every request sent to Django.

There are some posts online about logging middleware. The Django documentation talks about logger configuration and it seems that I can set it up to log everything without writing middleware.

  • Can I log everything without middleware?
  • What can middleware give me that a well-tuned Django logging config cannot?
  • Can I log INFO level messages, with DEBUG = False and no middleware?
  • How much extra load does logging everything add to my app?

Solution

  • if want to log every request, in that case, you should use Logging in middleware https://djangosnippets.org/snippets/428/