don't log full tracebacks

This commit is contained in:
Thomas Kriechbaumer 2016-12-17 18:28:34 +01:00
parent d4298cd747
commit 5cfc728d2e
3 changed files with 3 additions and 9 deletions

View File

@ -1,6 +1,5 @@
import threading import threading
import time import time
import traceback
import functools import functools
from typing import Dict, Callable, Any, List # noqa from typing import Dict, Callable, Any, List # noqa
@ -358,7 +357,6 @@ class Http2Layer(base.Layer):
self._cleanup_streams() self._cleanup_streams()
except Exception as e: # pragma: no cover except Exception as e: # pragma: no cover
self.log(repr(e), "info") self.log(repr(e), "info")
self.log(traceback.format_exc(), "debug")
self._kill_all_streams() self._kill_all_streams()
@ -624,7 +622,6 @@ class Http2SingleStreamLayer(httpbase._HttpTransmissionLayer, basethread.BaseThr
pass pass
except exceptions.ProtocolException as e: # pragma: no cover except exceptions.ProtocolException as e: # pragma: no cover
self.log(repr(e), "info") self.log(repr(e), "info")
self.log(traceback.format_exc(), "debug")
except exceptions.SetServerNotAllowedException as e: # pragma: no cover except exceptions.SetServerNotAllowedException as e: # pragma: no cover
self.log("Changing the Host server for HTTP/2 connections not allowed: {}".format(e), "info") self.log("Changing the Host server for HTTP/2 connections not allowed: {}".format(e), "info")
except exceptions.Kill: except exceptions.Kill:

View File

@ -1,5 +1,3 @@
import traceback
from mitmproxy import log from mitmproxy import log
from mitmproxy import controller from mitmproxy import controller
from mitmproxy import exceptions from mitmproxy import exceptions
@ -107,10 +105,10 @@ class RequestReplayThread(basethread.BaseThread):
"log", "log",
log.LogEntry("Connection killed", "info") log.LogEntry("Connection killed", "info")
) )
except Exception: except Exception as e:
self.channel.tell( self.channel.tell(
"log", "log",
log.LogEntry(traceback.format_exc(), "error") log.LogEntry(repr(e), "error")
) )
finally: finally:
r.first_line_format = first_line_format_backup r.first_line_format = first_line_format_backup

View File

@ -120,7 +120,6 @@ class ConnectionHandler:
except exceptions.Kill: except exceptions.Kill:
self.log("Connection killed", "info") self.log("Connection killed", "info")
except exceptions.ProtocolException as e: except exceptions.ProtocolException as e:
if isinstance(e, exceptions.ClientHandshakeException): if isinstance(e, exceptions.ClientHandshakeException):
self.log( self.log(
"Client Handshake failed. " "Client Handshake failed. "
@ -134,7 +133,7 @@ class ConnectionHandler:
else: else:
self.log(str(e), "warn") self.log(str(e), "warn")
self.log(traceback.format_exc(), "debug") self.log(repr(e), "debug")
# If an error propagates to the topmost level, # If an error propagates to the topmost level,
# we send an HTTP error response, which is both # we send an HTTP error response, which is both
# understandable by HTTP clients and humans. # understandable by HTTP clients and humans.