aviyoop commented on a change in pull request #210: ARIA-416 Providing handlers 
to logging_handlers only adds handles inst?
URL: 
https://github.com/apache/incubator-ariatosca/pull/210#discussion_r154592494
 
 

 ##########
 File path: aria/orchestrator/context/common.py
 ##########
 @@ -115,14 +115,19 @@ def __repr__(self):
 
     @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:
 
 Review comment:
   To prevent the original handlers from being duplicated, you should first (in 
the `finally` block) empty the logger from handlers, and then add the original 
handlers.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to