Also move logic to get the message from the request into a private method. There was starting to be too much logic in the tween. The rational for logging an exception when logging fails is that often this component is used just before one which converts all errors into ServerErrors (500) thus hiding any exceptions while logging. Error handling is in a separate function, this removes a circular reference caused by saving the traceback as a local variable. The function which gets the traceback is not being called when the error is raised, so it's local variables are not referenced by the traceback.
extra_info is set to True.
in dedent so the message is no longer indented. The user name displayed in the message no longer shows up as None when there is no user, it is now an empty string.
…info key is true
… exception message will include the request environ and parameters in the error message
…ns'. It was the only error.