ariatosca-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ARIA-416) Providing handlers to logging_handlers only adds handles instead of replacing
Date Mon, 04 Dec 2017 09:20:00 GMT

    [ https://issues.apache.org/jira/browse/ARIA-416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16276502#comment-16276502
] 

ASF GitHub Bot commented on ARIA-416:
-------------------------------------

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:
users@infra.apache.org


> Providing handlers to logging_handlers only adds handles instead of replacing 
> ------------------------------------------------------------------------------
>
>                 Key: ARIA-416
>                 URL: https://issues.apache.org/jira/browse/ARIA-416
>             Project: AriaTosca
>          Issue Type: Bug
>    Affects Versions: 0.2.0
>            Reporter: Maxim Orlov
>            Assignee: Maxim Orlov
>            Priority: Minor
>
> providing handlers to logging handlers only adds handles instead of replacing 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message