You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, I noticed that it duplicates error logging. In case of 500 error, it seems like Django already logs the exception, and with more context. This causes all errors to be reported twice: once with the generic Django handler and once with this middleware.
We're using Sentry and I noticed that the error logged from the middleware is less actionable: Sentry groups all occurrences together, and there is no stack trace attached.
I was going to suggest to add the option to override the action for error logging in subclasses, so that I could customise it more easily, but maybe we shouldn't log anything in the case of a 500, given that Django logging is good enough.
Then I thought a about more and wondered if anything >=500 make sense?
501: I'm never used this status, but I guess once could choose to return that
502, 503, 504: would typically be raised by a reverse proxy in front of the server, not by Django itself
505 and above: I'm not too sure to be honest...
What I Did
Got a 500 error
Saw 2 errors in Datadog (and Sentry) instead of one
The text was updated successfully, but these errors were encountered:
Description
In case of 5XX errors, the
RequestLoggingMiddleware
logs an error, usinglogger.error
:django-datadog-logger/django_datadog_logger/middleware/request_log.py
Lines 38 to 44 in d8a88da
However, I noticed that it duplicates error logging. In case of 500 error, it seems like Django already logs the exception, and with more context. This causes all errors to be reported twice: once with the generic Django handler and once with this middleware.
We're using Sentry and I noticed that the error logged from the middleware is less actionable: Sentry groups all occurrences together, and there is no stack trace attached.
I was going to suggest to add the option to override the action for error logging in subclasses, so that I could customise it more easily, but maybe we shouldn't log anything in the case of a 500, given that Django logging is good enough.
Then I thought a about more and wondered if anything >=500 make sense?
What I Did
The text was updated successfully, but these errors were encountered: