def _remove_stackdriver_handlers():
    for handler_ref in reversed(logging._handlerList[:]):
        handler = handler_ref()
        if not isinstance(handler, StackdriverTaskHandler):
            continue
        logging._removeHandlerRef(handler_ref)
        del handler
Ejemplo n.º 2
0
 def tearDown(self):
     handler = self.loghandler
     # All this is necessary to properly shut down the logging system and
     # avoid a regrtest complaint.  Thanks to Vinay Sajip for the help.
     handler.close()
     logger.removeHandler(handler)
     for ref in weakref.getweakrefs(handler):
         logging._removeHandlerRef(ref)
     del self.loghandler
     logger.setLevel(self._old_level)
     super(LoggingCatcher, self).tearDown()
Ejemplo n.º 3
0
 def tearDown(self):
     handler = self.loghandler
     # All this is necessary to properly shut down the logging system and
     # avoid a regrtest complaint.  Thanks to Vinay Sajip for the help.
     handler.close()
     logger.removeHandler(handler)
     for ref in weakref.getweakrefs(handler):
         logging._removeHandlerRef(ref)
     del self.loghandler
     logger.setLevel(self._old_level)
     super(LoggingCatcher, self).tearDown()
def _removeMultiProcHandlerRef(wr):
    """
    Remove a handler reference from the internal cleanup list.
    """
    # This function can be called during module teardown, when globals are
    # set to None. It can also be called from another thread. So we need to
    # pre-emptively grab the necessary globals and check if they're None,
    # to prevent race conditions and failures during interpreter shutdown.
    acquire, release = _acquireMultiProcLock, _releaseMultiProcLock
    if acquire and release:
        acquire()
        try:
            logging._removeHandlerRef(wr)
        finally:
            release()
 def removeLogger(self):
     logging._removeHandlerRef(self.log_Name)
Ejemplo n.º 6
0
 def tearDown(self) -> None:
     for handler_ref in logging._handlerList[:]:
         logging._removeHandlerRef(handler_ref)
     importlib.reload(airflow_local_settings)
     configure_logging()
Ejemplo n.º 7
0
def closeLog():
    handlers = list(logging._handlerList)
    for handler in handlers:
        logging._removeHandlerRef(handler)
        handler.flush()
        handler.close()