From 512d744da3e6836020feb5a71d949c5dad23db58 Mon Sep 17 00:00:00 2001 From: drebs Date: Mon, 27 Apr 2015 15:08:10 -0300 Subject: [bug] log traceback on sync failures on client Conversion of Twisted failures to string that rely on __str__ or __repr__ might not return all the information we would like to have, especially on sync failures. This commit asks for a detailed traceback of such failures and logs them both in Twisted and client logs. --- client/src/leap/soledad/client/api.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/src/leap/soledad/client/api.py b/client/src/leap/soledad/client/api.py index b2cabe08..ce026cdf 100644 --- a/client/src/leap/soledad/client/api.py +++ b/client/src/leap/soledad/client/api.py @@ -39,12 +39,11 @@ try: except ImportError: import chardet +from StringIO import StringIO from u1db.remote import http_client from u1db.remote.ssl_match_hostname import match_hostname from zope.interface import implements -from twisted.python import log - from leap.common.config import get_path_prefix from leap.soledad.common import SHARED_DB_NAME @@ -663,8 +662,10 @@ class Soledad(object): # that logs the failure and does not propagate it down the callback # chain def _errback(failure): - log.err(failure) - logger.error("Soledad exception when syncing: %s" % str(failure)) + s = StringIO() + failure.printDetailedTraceback(file=s) + msg = "Soledad exception when syncing!\n" + s.getvalue() + logger.error(msg) d.addCallbacks(on_sync_done, _errback) return d -- cgit v1.2.3