summaryrefslogtreecommitdiffstats
path: root/onap-dcae-dcaepolicy-lib/tests/log_ctx.py
diff options
context:
space:
mode:
Diffstat (limited to 'onap-dcae-dcaepolicy-lib/tests/log_ctx.py')
-rw-r--r--onap-dcae-dcaepolicy-lib/tests/log_ctx.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/onap-dcae-dcaepolicy-lib/tests/log_ctx.py b/onap-dcae-dcaepolicy-lib/tests/log_ctx.py
index 9f5464d..0d82687 100644
--- a/onap-dcae-dcaepolicy-lib/tests/log_ctx.py
+++ b/onap-dcae-dcaepolicy-lib/tests/log_ctx.py
@@ -1,8 +1,5 @@
-""":@CtxLogger.log_ctx: decorator for logging the cloudify ctx before and after operation"""
-
-# org.onap.dcae
# ================================================================================
-# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,7 +16,10 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+""":@CtxLogger.log_ctx: decorator for logging the cloudify ctx before and after operation"""
+
import json
+import traceback
from functools import wraps
from cloudify import ctx
@@ -102,7 +102,8 @@ class CtxLogger(object):
ctx.logger.info("{0} context: {1}".format(\
func_name, json.dumps(CtxLogger.get_ctx_info())))
except Exception as ex:
- ctx.logger.error("Failed to log the node context: {0}".format(str(ex)))
+ ctx.logger.error("Failed to log the node context: {0}: {1}" \
+ .format(str(ex), traceback.format_exc()))
@staticmethod
def log_ctx(pre_log=True, after_log=False, exe_task=None):
@@ -119,8 +120,8 @@ class CtxLogger(object):
if ctx.type == NODE_INSTANCE and exe_task:
ctx.instance.runtime_properties[exe_task] = func.__name__
except Exception as ex:
- ctx.logger.error("Failed to set exe_task {0}: {1}".format(\
- exe_task, str(ex)))
+ ctx.logger.error("Failed to set exe_task {0}: {1}: {2}" \
+ .format(exe_task, str(ex), traceback.format_exc()))
if pre_log:
CtxLogger.log_ctx_info('before ' + func.__name__)