This is an automated email from the ASF dual-hosted git repository. mxmrlv pushed a commit to branch ARIA-416-Providing-handlers-to-logging_handlers-only-adds-handles-instead-of-replacing in repository https://gitbox.apache.org/repos/asf/incubator-ariatosca.git
commit 164ff365107105f379aa537a28c95c8cc0f04e57 Author: max-orlov <[email protected]> AuthorDate: Tue Nov 28 17:20:12 2017 +0200 ARIA-416 Providing handlers to logging_handlers only adds handles instead of replacing --- aria/orchestrator/context/common.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index 90205fd..cb2b37c 100644 --- a/aria/orchestrator/context/common.py +++ b/aria/orchestrator/context/common.py @@ -115,14 +115,19 @@ class BaseContext(object): @contextmanager def logging_handlers(self, handlers=None): + original_handlers = self.logger.handlers handlers = handlers or [] try: for handler in handlers: self.logger.addHandler(handler) + for handler in original_handlers: + self.logger.removeHandler(handler) yield self.logger finally: for handler in handlers: self.logger.removeHandler(handler) + for handler in original_handlers: + self.logger.addHandler(handler) @property def model(self): -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
