Logging JSONRPC Exception
This commit is contained in:
parent
6a452319f9
commit
2ab99ce8e9
|
@ -1,34 +0,0 @@
|
|||
diff -r dfbbed6b42d5 trytond/trytond/protocols/dispatcher.py
|
||||
--- a/trytond/trytond/protocols/dispatcher.py Thu Apr 07 00:04:01 2016 +0200
|
||||
+++ b/trytond/trytond/protocols/dispatcher.py Thu Apr 07 10:50:57 2016 +0200
|
||||
@@ -212,7 +212,7 @@
|
||||
logger.error(log_message, *log_args, exc_info=True)
|
||||
raise
|
||||
except (ConcurrencyException, UserError, UserWarning):
|
||||
- logger.debug(log_message, *log_args, exc_info=True)
|
||||
+ logger.warning(log_message, *log_args, exc_info=True)
|
||||
raise
|
||||
except Exception:
|
||||
logger.error(log_message, *log_args, exc_info=True)
|
||||
diff -r dfbbed6b42d5 trytond/protocols/jsonrpc.py
|
||||
--- a/trytond/trytond/protocols/jsonrpc.py Thu Apr 07 00:04:01 2016 +0200
|
||||
+++ b/trytond/trytond/protocols/jsonrpc.py Thu Apr 07 10:50:57 2016 +0200
|
||||
@@ -9,6 +9,7 @@
|
||||
except ImportError:
|
||||
import json
|
||||
import base64
|
||||
+import logging
|
||||
|
||||
from werkzeug.wrappers import Response
|
||||
from werkzeug.utils import cached_property
|
||||
@@ -123,6 +124,10 @@
|
||||
try:
|
||||
return json.loads(self.decoded_data, object_hook=JSONDecoder())
|
||||
except Exception:
|
||||
+ exc_type, exc_value = sys.exc_info()[:2]
|
||||
+ logger = logging.getLogger(__name__)
|
||||
+ logger.warning('Exception while parsing json: %s (%s)\n %s'
|
||||
+ % (exc_value, exc_type, traceback.format_exc()))
|
||||
raise BadRequest('Unable to read JSON request')
|
||||
else:
|
||||
raise BadRequest('Not a JSON request')
|
|
@ -0,0 +1,32 @@
|
|||
diff -r 6c0d835dd918 trytond/trytond/protocols/dispatcher.py
|
||||
--- a/trytond/trytond/protocols/dispatcher.py Wed May 11 10:40:32 2016 +0200
|
||||
+++ b/trytond/trytond/protocols/dispatcher.py Mon May 30 15:10:42 2016 +0200
|
||||
@@ -214,7 +214,7 @@
|
||||
logger.error(log_message, *log_args, exc_info=True)
|
||||
raise
|
||||
except (ConcurrencyException, UserError, UserWarning):
|
||||
- logger.debug(log_message, *log_args, exc_info=True)
|
||||
+ logger.warning(log_message, *log_args, exc_info=True)
|
||||
raise
|
||||
except Exception:
|
||||
logger.error(log_message, *log_args, exc_info=True)
|
||||
diff -r 6c0d835dd918 trytond/trytond/protocols/jsonrpc.py
|
||||
--- a/trytond/trytond/protocols/jsonrpc.py Wed May 11 10:40:32 2016 +0200
|
||||
+++ b/trytond/trytond/protocols/jsonrpc.py Mon May 30 15:10:42 2016 +0200
|
||||
@@ -9,6 +9,7 @@
|
||||
except ImportError:
|
||||
import json
|
||||
import base64
|
||||
+import logging
|
||||
|
||||
from werkzeug.wrappers import Response
|
||||
from werkzeug.utils import cached_property
|
||||
@@ -17,6 +18,8 @@
|
||||
from trytond.protocols.wrappers import Request
|
||||
from trytond.exceptions import TrytonException
|
||||
|
||||
+logger = logging.getLogger(__name__)
|
||||
+
|
||||
|
||||
class JSONDecoder(object):
|
||||
|
Loading…
Reference in New Issue