Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log unexpected exceptions in exception view #5820

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lms/views/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import logging

from pyramid import i18n
from pyramid.config import not_
from pyramid.httpexceptions import HTTPClientError
Expand All @@ -14,6 +16,8 @@

_ = i18n.TranslationStringFactory(__package__)

LOG = logging.getLogger(__name__)


@view_defaults(path_info=not_("^/api/.*"), renderer="lms:templates/error.html.jinja2")
class ExceptionViews:
Expand Down Expand Up @@ -94,6 +98,7 @@ def serializable_error(self):

@exception_view_config(context=Exception)
def error(self):
LOG.exception("Unexpected error %s", type(self.exception))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are completely silent in the local logs. Or at least some of them

return self.error_response(
500,
_(
Expand Down