before adding any handlers, we check that theere are no handlers at the moment.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/0e848f5a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/0e848f5a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/0e848f5a Branch: refs/heads/logger_task Commit: 0e848f5a15995e8fa51df9bb49630a0f0224d06d Parents: 1c48a6a Author: max-orlov <[email protected]> Authored: Sun Apr 2 18:29:43 2017 +0300 Committer: Ran Ziv <[email protected]> Committed: Thu Apr 6 11:29:17 2017 +0300 ---------------------------------------------------------------------- aria/orchestrator/context/common.py | 13 ++++++------- aria/orchestrator/context/workflow.py | 1 - 2 files changed, 6 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e848f5a/aria/orchestrator/context/common.py ---------------------------------------------------------------------- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index f631e79..2e33d77 100644 --- a/aria/orchestrator/context/common.py +++ b/aria/orchestrator/context/common.py @@ -19,7 +19,6 @@ A common context for both workflow and operation import logging from contextlib import contextmanager -from datetime import datetime from functools import partial import jinja2 @@ -68,13 +67,13 @@ class BaseContext(object): self._workdir = workdir self.logger = None - def _register_logger(self, logger_name=None, level=None, task_id=None): - self.logger = self.PrefixedLogger(logging.getLogger(logger_name or self.__class__.__name__), - self.logging_id, - task_id=task_id) - self.logger.addHandler(aria_logger.create_console_log_handler()) - self.logger.addHandler(self._get_sqla_handler()) + def _register_logger(self, level=None, task_id=None): + self.logger = self.PrefixedLogger( + logging.getLogger('aria.executions.task'), self.logging_id, task_id=task_id) self.logger.setLevel(level or logging.DEBUG) + if not self.logger.handlers: + self.logger.addHandler(aria_logger.create_console_log_handler()) + self.logger.addHandler(self._get_sqla_handler()) def _get_sqla_handler(self): api_kwargs = {} http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e848f5a/aria/orchestrator/context/workflow.py ---------------------------------------------------------------------- diff --git a/aria/orchestrator/context/workflow.py b/aria/orchestrator/context/workflow.py index bc9f653..ad4a2ff 100644 --- a/aria/orchestrator/context/workflow.py +++ b/aria/orchestrator/context/workflow.py @@ -19,7 +19,6 @@ Workflow and operation contexts import threading from contextlib import contextmanager -from datetime import datetime from .exceptions import ContextException from .common import BaseContext
