
Product
Reachability for Ruby Now in Beta
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.
django-error-logger
Advanced tools
Keep It Simple and Stupid replacement of Sentry for error logging in django project.
A Django application that logs HTTP 500 errors to the database, capturing detailed context including user information, request details, and POST data.
From any Django project:
pip install django-error-logger
After installation, integrate into your Django project:
Edit settings.py:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# ... your other apps ...
'error_logger', # Add this
]
Edit settings.py:
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
# ... your other middleware ...
'error_logger.middleware.ErrorLoggingMiddleware', # Add at the end
]
Edit your main urls.py:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
# ... your other URLs ...
path('error-logger/', include('error_logger.urls')), # Add this
]
python manage.py migrate error_logger
# Start your Django server
python manage.py runserver
# Trigger a test error (development only!)
curl http://localhost:8000/error-logger/test/500/
# Check Django admin
open http://localhost:8000/admin/error_logger/errorlog/
To access the error logger views (such as the error log list, details, and test endpoints), users must be logged in and have the error_logger.view_errorlog permission. This permission is automatically created when you run migrations.
You can assign this permission to users or groups via the Django admin interface:
Alternatively, you can assign permissions programmatically in your code or via fixtures.
Note: Only users with this permission can access the error logger URLs. Ensure your authentication system is properly configured.
To enable the "impersonate user" feature in admin:
pip install django-su
Then add to settings.py:
INSTALLED_APPS = [
# ...
'django_su',
'error_logger',
]
And add to urls.py:
urlpatterns = [
# ...
path('su/', include('django_su.urls')),
]
Before deploying to production:
error_logger/views.py/error-logger/ URLsSENSITIVE_FIELDS list for your appThe following fields are automatically redacted in POST data logs:
password, password1, password2, old_password, new_passwordtoken, access_token, refresh_token, api_key, secretcredit_card, cvv, ssn, pinYou can customize this list in middleware.py:
SENSITIVE_FIELDS = [
'password', 'token', 'api_key', 'secret',
# Add your custom sensitive fields here
]
By default, POST payloads larger than 100KB are not logged in full. You can adjust this in middleware.py:
MAX_POST_SIZE = 100 * 1024 # 100KB (default)
# MAX_POST_SIZE = 1024 * 1024 # 1MB
Access the error logs through Django admin at /admin/error_logger/errorlog/
Features:
django_su)⚠️ Important: These endpoints should only be accessible in development/testing environments. Remove or restrict access in production.
Access these endpoints at /error-logger/test/:
URL: /error-logger/test/500/
Triggers a ZeroDivisionError to test basic error logging.
curl http://localhost:8000/error-logger/test/500/
URL: /error-logger/test/value-error/
Triggers a ValueError with a custom message.
curl http://localhost:8000/error-logger/test/value-error/
URL: /error-logger/test/key-error/
Triggers a KeyError by accessing a non-existent dictionary key.
curl http://localhost:8000/error-logger/test/key-error/
URL: /error-logger/test/post-error/
Tests error logging with POST data including sensitive fields (password, token).
Form Fields:
username: Regular text fieldpassword: Will be redacted in logsemail: Email fieldtoken: Will be redacted in logsUsage:
cURL Example:
curl -X POST http://localhost:8000/error-logger/test/post-error/ \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=testuser&password=secret123&email=test@example.com&token=abc123"
URL: /error-logger/test/large-post-error/
Tests error logging with a large POST payload (150KB) that exceeds the logging limit.
Form Fields:
username: Regular text fieldpassword: Will be redacted in logslarge_field: Pre-filled with 150KB of dataUsage:
Expected Result:
The error log's additional_info should contain:
{
"post_data": {
"error": "POST payload too large to log",
"size_bytes": 153600,
"size_kb": 150.0,
"size_mb": 0.15
}
}
| Field | Type | Description |
|---|---|---|
user | ForeignKey | User who encountered the error (null if anonymous) |
error_message | TextField | Plain text exception message |
error_type | CharField | Exception class name (e.g., "ValueError") |
traceback | TextField | Plain text Python traceback |
html_traceback | TextField | HTML version of Django's debug page |
error_time | DateTimeField | When the error occurred |
path | CharField | Request path |
method | CharField | HTTP method (GET, POST, etc.) |
user_agent | CharField | User's browser/client |
ip_address | GenericIPAddressField | Client IP address |
query_string | TextField | URL query parameters |
additional_info | JSONField | POST data and request headers |
SENSITIVE_FIELDS list to ensure all sensitive data in your application is redacteddjango_su (for user impersonation feature)AGPL-3.0
FAQs
A Django application that logs HTTP 500 errors with detailed context
We found that django-error-logger demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.

Research
/Security News
Malicious npm packages use Adspect cloaking and fake CAPTCHAs to fingerprint visitors and redirect victims to crypto-themed scam sites.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.