Skip to content
Myr

Refactored logging of internal server errors. Can now be customized

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent c0f42a0 · Browse files · 1 file+14 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+14 added−4 removed

  • other:+14 added−4 removed

1 file+14 added−4 removed

modified:flask/app.py+14 added-4 removed
1214 unmodified lines
1215 raise exc_type, exc_value, tb1216 else:1217 raise e12181219 self.logger.exception('Exception on %s [%s]' % (1220 request.path,1221 request.method1222 ))1219 self.log_exception((exc_type, exc_value, tb))1220 if handler is None:1221 return InternalServerError()1222 return handler(e)12231224 def log_exception(self, exc_info):1225 """Logs an exception. This is called by :meth:`handle_exception`1226 if debugging is disabled and right before the handler is called.1227 The default implementation logs the exception as error on the1228 :attr:`logger`.12291230 .. versionadded:: 0.81231 """1232 self.logger.error('Exception on %s [%s]' % (1233 request.path,1234 request.method1235 ), exc_info=exc_info)12361237 def raise_routing_exception(self, request):1238 """Exceptions that are recording during routing are reraised with1239 this method. During debug we are not reraising redirect requests1240 for non ``GET``, ``HEAD``, or ``OPTIONS`` requests and we're raising
303 unmodified lines