Skip to content

Instantly share code, notes, and snippets.

@DazWorrall
Created September 24, 2012 08:55
Show Gist options
  • Select an option

  • Save DazWorrall/3775003 to your computer and use it in GitHub Desktop.

Select an option

Save DazWorrall/3775003 to your computer and use it in GitHub Desktop.
Subclass the Flask exception handler
'''
Original here: https://github.com/mitsuhiko/flask/blob/master/flask/app.py#L1295
'''
from flask import Flask
class MyFlask(Flask):
def log_exception(self, exc_info):
"""
Overriden to provide the full url (including scheme, hostname and query string)
in the error message
"""
self.logger.error('Exception on %s [%s]' % (
request.url, # This is what we've changed from the original
request.method
), exc_info=exc_info)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment