diff --git a/benefits/core/middleware.py b/benefits/core/middleware.py index 42e2d0331a..75f4b5f98a 100644 --- a/benefits/core/middleware.py +++ b/benefits/core/middleware.py @@ -161,21 +161,6 @@ def process_view(self, request, view_func, view_args, view_kwargs): return redirect("oauth:login") -# https://github.com/census-instrumentation/opencensus-python/issues/766 -class LogErrorToAzure(MiddlewareMixin): - def __init__(self, get_response): - self.get_response = get_response - # wait to do this here to be sure the handler is initialized - self.azure_logger = logging.getLogger("azure") - - def process_exception(self, request, exception): - # https://stackoverflow.com/a/45532289 - msg = getattr(exception, "message", repr(exception)) - self.azure_logger.exception(msg, exc_info=exception) - - return None - - class RecaptchaEnabled(MiddlewareMixin): """Middleware configures the request with required reCAPTCHA settings.""" diff --git a/benefits/settings.py b/benefits/settings.py index 862fe5542f..1a0bbaedc9 100644 --- a/benefits/settings.py +++ b/benefits/settings.py @@ -74,12 +74,7 @@ def _filter_empty(ls): ENABLE_AZURE_INSIGHTS = "APPLICATIONINSIGHTS_CONNECTION_STRING" in os.environ print("ENABLE_AZURE_INSIGHTS: ", ENABLE_AZURE_INSIGHTS) if ENABLE_AZURE_INSIGHTS: - MIDDLEWARE.extend( - [ - "opencensus.ext.django.middleware.OpencensusMiddleware", - "benefits.core.middleware.LogErrorToAzure", - ] - ) + MIDDLEWARE.append("opencensus.ext.django.middleware.OpencensusMiddleware") # only used if enabled above OPENCENSUS = { diff --git a/docs/deployment/troubleshooting.md b/docs/deployment/troubleshooting.md index 216a70a9ee..1dff286369 100644 --- a/docs/deployment/troubleshooting.md +++ b/docs/deployment/troubleshooting.md @@ -29,7 +29,7 @@ The following [tables](https://docs.microsoft.com/en-us/azure/azure-monitor/app/ In the latter two, you should see recent log output. Note [there is some latency](https://docs.microsoft.com/en-us/azure/azure-monitor/logs/data-ingestion-time). -See [`Failures`](https://docs.microsoft.com/en-us/azure/azure-monitor/app/asp-net-exceptions#diagnose-failures-using-the-azure-portal) in the sidebar (or `exceptions` under `Logs`) for application errors/exceptions. +Note that we aren't [sending exceptions to Azure Monitor](https://learn.microsoft.com/en-us/azure/azure-monitor/app/opencensus-python#send-exceptions) (aside from the logs), so you won't see anything show up under `Failures` or `Logs`->`exceptions`. ### Live tail