Fix a logging bug that causes unicode error.

How to reproduce:
Calling logging.exception('…'), and sys.exc_info() contains non-ascii charachers.