diff options
author | 2020-08-24 18:06:49 +0000 | |
---|---|---|
committer | 2020-08-24 18:06:49 +0000 | |
commit | d8717dfc2217fd641279d835c53bb5557b4384a7 (patch) | |
tree | d1f48fca0a38e8b85fe00b38e49b18b0e51355a4 /ms/command-executor/src/main/python/utils.py | |
parent | d586bc5373e079d03e2387dfeb5f9bf323edd3f6 (diff) | |
parent | 0f0b5a02d777482e0011b3bc7276d410ee643ae8 (diff) |
Merge "Add request IDs in command-executor log"
Diffstat (limited to 'ms/command-executor/src/main/python/utils.py')
-rw-r--r-- | ms/command-executor/src/main/python/utils.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/ms/command-executor/src/main/python/utils.py b/ms/command-executor/src/main/python/utils.py index 54c5ceafa..c624a3d2e 100644 --- a/ms/command-executor/src/main/python/utils.py +++ b/ms/command-executor/src/main/python/utils.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2019 Bell Canada. +# Copyright (C) 2019 - 2020 Bell Canada. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -79,7 +79,7 @@ def truncate_execution_output(execution_output): # Read temp file 'outputfile' into results_log and split out the returned payload into payload_result -def parse_cmd_exec_output(outputfile, logger, payload_result, results_log): +def parse_cmd_exec_output(outputfile, logger, payload_result, results_log, extra): payload_section = [] is_payload_section = False outputfile.seek(0) @@ -98,8 +98,17 @@ def parse_cmd_exec_output(outputfile, logger, payload_result, results_log): for part in msg.get_payload(): payload_result.update(json.loads(part.get_payload())) if output and not is_payload_section: - logger.info(output.strip()) + logger.info(output.strip(), extra=extra) results_log.append(output.strip()) else: payload_section.append(output.strip()) +def getExtraLogData(request=None): + extra = {'request_id' : '', 'subrequest_id' : '', 'originator_id': ''} + if request is not None: + extra = { + 'request_id' : request.requestId, + 'subrequest_id' : request.subRequestId, + 'originator_id': request.originatorId + } + return extra
\ No newline at end of file |