Surpress log with context data and db data

When debugging mistral workflow with openstack actions in multi-region
environment, there are a lot of huge blocks containing openstack
service catalog in the log file. It's not necessary to print the whole
context data sometimes.

What's more, we should avoid logging whole database instance
information. Let's keep the log useful and simple.

Change-Id: I415ea40517fb00936cfcdaab8fac1243689b0187
This commit is contained in:
Lingxian Kong
2017-03-22 15:10:38 +13:00
parent fbe2b3289a
commit e60ae2302b
8 changed files with 41 additions and 44 deletions

View File

@@ -92,8 +92,8 @@ def _check_and_complete(wf_ex_id):
incomplete_tasks_count = wf.check_and_complete()
except exc.MistralException as e:
msg = (
"Failed to check and complete [wf_ex=%s]:"
" %s\n%s" % (wf_ex, e, tb.format_exc())
"Failed to check and complete [wf_ex_id=%s, wf_name=%s]:"
" %s\n%s" % (wf_ex_id, wf_ex.name, e, tb.format_exc())
)
LOG.error(msg)
@@ -154,7 +154,8 @@ def set_workflow_state(wf_ex, state, msg=None):
pause_workflow(wf_ex, msg)
else:
raise exc.MistralError(
'Invalid workflow state [wf_ex=%s, state=%s]' % (wf_ex, state)
'Invalid workflow execution state [wf_ex_id=%s, wf_name=%s, '
'state=%s]' % (wf_ex.id, wf_ex.name, state)
)