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 9046d7946a8df6e7945e8278eaafd455fa393dc1
Author: max-orlov <ma...@gigaspaces.com>
AuthorDate: Tue Nov 28 17:20:12 2017 +0200

    handler configuration is more explicit
---
 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 3c5f618..87444a9 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
"comm...@ariatosca.apache.org" <comm...@ariatosca.apache.org>.

Reply via email to