Try log an exception when logging fails.

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.
Move error handling to 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.

Thanks to Tres for pointing this out:
https://github.com/Pylons/pyramid_exclog/pull/12#discussion_r2812532