From 23335f5d996017389a1918af1075847006ac8617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Volkan=20=C5=9Eahin?= Date: Tue, 2 Aug 2016 18:16:53 +0300 Subject: [PATCH] some fixing about logs --- opt/ahenk/ahenkd.py | 6 ++++-- opt/ahenk/base/command/commander.py | 15 ++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/opt/ahenk/ahenkd.py b/opt/ahenk/ahenkd.py index 1431524..060c561 100755 --- a/opt/ahenk/ahenkd.py +++ b/opt/ahenk/ahenkd.py @@ -262,10 +262,12 @@ class AhenkDeamon(BaseDaemon): db_service = scope.getDbService() execute_manager = scope.getExecutionManager() + event='' try: - json_data = json.loads(Commander().get_event()) + event=Commander().get_event() + json_data = json.loads(event) except Exception as e: - self.logger.error('[AhenkDeamon] A problem occurred while loading json. Check json format! Error Message: {0}'.format(str(e))) + self.logger.error('[AhenkDeamon] A problem occurred while loading json. Check json format! Error Message: {0}.Event={1} '.format(str(e),str(event))) return if json_data is not None: diff --git a/opt/ahenk/base/command/commander.py b/opt/ahenk/base/command/commander.py index 1a74287..44dd469 100644 --- a/opt/ahenk/base/command/commander.py +++ b/opt/ahenk/base/command/commander.py @@ -79,7 +79,8 @@ class Commander(object): response['contentType'] = self.get_relevant_type(str(params[5])) response['responseData'] = Util.read_file(str(params[5]), 'rb') else: - print('Wrong or missing parameter. Usage: send -t -m|-f |') + print( + 'Wrong or missing parameter. Usage: send -t -m|-f |') return None if len(params) > 6: @@ -90,7 +91,8 @@ class Commander(object): elif params[6] == '-s': response['responseCode'] = MessageCode.TASK_PROCESSED.value else: - print('Wrong or missing parameter.(-e|-s|-w parameters are optional) Usage: send -t -m|-f | -e|-s|-w') + print( + 'Wrong or missing parameter.(-e|-s|-w parameters are optional) Usage: send -t -m|-f | -e|-s|-w') return None elif len(params) > 7 and params[2] == '-p': @@ -109,7 +111,8 @@ class Commander(object): response['contentType'] = self.get_relevant_type(str(params[7])) response['responseData'] = Util.read_file(str(params[7]), 'rb') else: - print('Wrong or missing parameter. Usage: send -p -c -m|-f |') + print( + 'Wrong or missing parameter. Usage: send -p -c -m|-f |') return None if len(params) > 8: @@ -120,11 +123,13 @@ class Commander(object): elif params[8] == '-s': response['responseCode'] = MessageCode.POLICY_PROCESSED.value else: - print('Wrong or missing parameter.(-e|-s|-w parameters are optional) Usage: send -p -c -m|-f | -e|-s|-w') + print( + 'Wrong or missing parameter.(-e|-s|-w parameters are optional) Usage: send -p -c -m|-f | -e|-s|-w') return None else: - print('Wrong or missing parameter. Usage: send -p -c -m|-f | -e|-s|-w') + print( + 'Wrong or missing parameter. Usage: send -p -c -m|-f | -e|-s|-w') return None resp = str(response).replace("\"{", "{")