"""
    Walks the tree of loggers and tries to set the context for each handler
    :param logger: logger
    :param value: value to set
    """
    while logger:
        orig_propagate = logger.propagate
        for handler in logger.handlers:
            
            
            
            
            if hasattr(handler, "set_context"):
                from airflow.utils.log.file_task_handler import FileTaskHandler
                flag = cast(FileTaskHandler, handler).set_context(value)
                
                
                if flag is not SetContextPropagate.MAINTAIN_PROPAGATE:
                    logger.propagate = False
        if orig_propagate is True:
            
            logger = logger.parent
        else:
            break