--- id: django-request-logging version: "0.7.5" license: MIT license_treatment: permissive maintenance: dormant --- # django-request-logging — Django middleware that logs http request body. License: permissive · Maintenance: dormant · Downloads: 184.0K/mo ## What it is and what it does django-request-logging is a Django middleware that intercepts HTTP requests and responses, logging their payloads with color-coded output for easier debugging. It logs request headers, body, and response content, with automatic log-level escalation for 400-599 status codes. The middleware supports fine-grained control via a @no_logging decorator for views handling sensitive data, allowing per-view configuration of what gets logged (headers, body, response, or none). It also masks sensitive headers like HTTP_AUTHORIZATION by default and respects Django's standard logging configuration. The package is designed to work with both traditional web requests and API calls, and provides settings to customize behavior globally—including max body length (default 50000 characters), colorization, log levels, and which headers to redact. Installation requires only adding the middleware to Django's MIDDLEWARE tuple and configuring a logger for 'django.request'. Use it for: - Debug API requests and responses during development by viewing colored, structured logs of payloads. - Audit HTTP traffic in staging or production by logging request/response bodies with automatic sensitive-header masking. - Exclude logging from views handling passwords or tokens using the @no_logging decorator to prevent credential leaks. - Troubleshoot client integration issues by examining logged request headers and response content without code changes. - Customize log verbosity per environment—disable colorization for file logging, adjust log levels for 4xx errors. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. A Django middleware that logs HTTP request and response payloads with color-coded output, supporting both web and API requests with configurable detail levels and sensitive header masking. Yes, if you are on a stable Django version and accept the maintenance risk. The package is simple, low-friction to install, has no security vulnerabilities, and solves a real debugging need. However, it is dormant (last release February 2022) and may not work with Django versions released after that date. Verify compatibility with your Django version before committing to it. ## Install pip install django-request-logging uv add django-request-logging poetry add django-request-logging ## Installing django-request-logging Before you install: Installation is straightforward with low friction—a single runtime dependency on Django and a wheel distribution. However, the package is dormant: last release was in February 2022, with no recent commits despite the repository remaining active. Use only if you accept that bugs and compatibility issues may not be addressed. License in practice: MIT license is permissive and imposes no restrictions on use, modification, or distribution in commercial or private projects. Quickstart: pip install django-request-logging # In Django settings.py MIDDLEWARE: MIDDLEWARE = ( 'request_logging.middleware.LoggingMiddleware', ) # Configure logging: LOGGING = { 'loggers': { 'django.request': { 'level': 'DEBUG', }, }, } Requires Django to be installed and configured; middleware must be added to MIDDLEWARE tuple in settings. Verify before relying: - Current compatibility with Django versions released after February 2022. - Whether the package works reliably with modern Python versions beyond those tested at release. ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: dormant - Downloads: 184.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags django request logging middleware, http request response logging, django api request logging, colored request logging django, django payload logging, request body logging middleware, django http debugging, django-middleware, request-logging, debugging [View on SkillFed](https://skillfed.io/packages/django-request-logging) · [View on PyPI](https://pypi.org/project/django-request-logging/)