This is an automated email from the ASF dual-hosted git repository.

avia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ariatosca.git

commit f17ae3133c50985148090c25240734abca9ceec9
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 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 90205fd..62b4c8e 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -114,15 +114,20 @@ class BaseContext(object):
             .format(name=self.__class__.__name__, self=self))
 
     @contextmanager
-    def logging_handlers(self, handlers=None):
+    def logging_handlers(self, handlers):
+        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:
+            for handler in self.logger.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]>.

Reply via email to