{"id":23078,"library":"drf-api-logger","title":"DRF API Logger","description":"An API Logger for Django Rest Framework that logs request/response details (headers, body, status, timing) to the database. Provides an admin panel to view and filter logs. v1.2.0 (2025-01) adds profiling for per-request latency breakdown. Release cadence: irregular, multiple minor releases per year.","status":"active","version":"1.2.0","language":"python","source_language":"en","source_url":"https://github.com/vishalanandl177/DRF-API-Logger","tags":["django","drf","logging","api","middleware"],"install":[{"cmd":"pip install drf-api-logger","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core framework dependency","package":"django","optional":false},{"reason":"DRF is required for the logger to intercept API calls","package":"djangorestframework","optional":false}],"imports":[{"note":"The middleware is in the middleware submodule, not the package root.","wrong":"from drf_api_logger import DRFApiLoggerMiddleware","symbol":"DRFApiLoggerMiddleware","correct":"from drf_api_logger.middleware import DRFApiLoggerMiddleware"}],"quickstart":{"code":"# settings.py\nINSTALLED_APPS = [\n    ...\n    'drf_api_logger',\n]\n\nMIDDLEWARE = [\n    ...\n    'drf_api_logger.middleware.DRFApiLoggerMiddleware',\n]\n\nDRF_API_LOGGER_DATABASE = True  # defaults to True\nDRF_API_LOGGER_SLOW_API_ABOVE = 200  # ms, optional\nDRF_API_LOGGER_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']\n\n# Run migration after adding to INSTALLED_APPS\n# python manage.py migrate\n","lang":"python","description":"Add 'drf_api_logger' to INSTALLED_APPS, insert DRFApiLoggerMiddleware after CommonMiddleware, then migrate. The logs are viewable at /admin/drf_api_logger/apilogsmodel/"},"warnings":[{"fix":"Run `python manage.py migrate drf_api_logger` after upgrading.","message":"In v1.2.0, profiling data is stored in extra database columns. If you upgrade from <1.2.0, you must run migrations (may require schema changes).","severity":"breaking","affected_versions":"<1.2.0"},{"fix":"Add `DRF_API_LOGGER_SENSITIVE_DATA_MASK = ['password', 'token', 'secret', ...]` in settings.","message":"The middleware logs request bodies, which can expose sensitive data. By default, it masks some commonly sensitive keys, but you must extend with DRF_API_LOGGER_SENSITIVE_DATA_MASK or set DRF_API_LOGGER_EXCLUDE_KEYS to avoid logging passwords, tokens, etc.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to >=1.1.16 or add DRF_API_LOGGER_SKIP_URLS = ['/static/', '/media/'].","message":"Static/media file requests may also be logged unless you configure DRF_API_LOGGER_SKIP_URLS or upgrade to v1.1.16+ which skips them by default.","severity":"gotcha","affected_versions":"<1.1.16"},{"fix":"Use `request.path_info` instead of `request.path` in any custom extensions.","message":"In v1.1.11 the middleware changed from `request.path` to `request.path_info`. If you have custom middleware relying on the old path, it may break.","severity":"deprecated","affected_versions":">=1.1.11"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `from drf_api_logger.middleware import DRFApiLoggerMiddleware`.","cause":"The middleware was moved to a submodule in v1.0.0; importing from the root fails.","error":"No module named 'drf_api_logger.middleware'"},{"fix":"Run `python manage.py migrate drf_api_logger`.","cause":"The database table hasn't been created because migrations weren't run after adding the app.","error":"django.db.utils.OperationalError: no such table: drf_api_logger_apilogsmodel"},{"fix":"Upgrade Django to >=1.9 or set `DRF_API_LOGGER_PATCH_ROOT_PATH_INFO = True` (not a real setting; this is a known limitation).","cause":"Using Django <1.9 (very old) or a non-WSGI environment; path_info may not be available.","error":"AttributeError: 'WSGIRequest' object has no attribute 'path_info'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}