diff --git a/dvc/cli/__init__.py b/dvc/cli/__init__.py index 9b14059bb..2817a5c4a 100644 --- a/dvc/cli/__init__.py +++ b/dvc/cli/__init__.py @@ -153,7 +153,7 @@ def main(argv=None): # noqa: C901 from dvc._debug import debugtools from dvc.config import ConfigError from dvc.exceptions import DvcException, NotDvcRepoError - from dvc.logger import disable_other_loggers, set_loggers_level + from dvc.logger import set_loggers_level # NOTE: stderr/stdout may be closed if we are running from dvc.daemon. # On Linux we directly call cli.main after double forking and closing @@ -166,7 +166,6 @@ def main(argv=None): # noqa: C901 logging.disable(logging.INFO) args = None - disable_other_loggers() outerLogLevel = logger.level try: diff --git a/dvc/logger.py b/dvc/logger.py index 092f2427d..e08e45a8f 100644 --- a/dvc/logger.py +++ b/dvc/logger.py @@ -180,14 +180,6 @@ def _iter_causes(exc): exc = exc.__cause__ -def disable_other_loggers(): - logging.captureWarnings(True) - loggerDict = logging.root.manager.loggerDict # pylint: disable=no-member - for logger_name, logger in loggerDict.items(): - if logger_name != "dvc" and not logger_name.startswith("dvc."): - logger.disabled = True # type: ignore[union-attr] - - def set_loggers_level(level: int = logging.INFO) -> None: for name in ["dvc", "dvc_objects", "dvc_data"]: logging.getLogger(name).setLevel(level) diff --git a/dvc/repo/experiments/executor/base.py b/dvc/repo/experiments/executor/base.py index 3e962af51..b4134f174 100644 --- a/dvc/repo/experiments/executor/base.py +++ b/dvc/repo/experiments/executor/base.py @@ -716,13 +716,10 @@ class BaseExecutor(ABC): @staticmethod def _set_log_level(level): - from dvc.logger import disable_other_loggers - # When executor.reproduce is run in a multiprocessing child process, # dvc.cli.main will not be called for that child process so we need to # setup logging ourselves dvc_logger = logging.getLogger("dvc") - disable_other_loggers() if level is not None: dvc_logger.setLevel(level) diff --git a/tests/dir_helpers.py b/tests/dir_helpers.py index 8cc4d977b..b96671676 100644 --- a/tests/dir_helpers.py +++ b/tests/dir_helpers.py @@ -49,8 +49,6 @@ import pathlib import pytest -from dvc.logger import disable_other_loggers - __all__ = [ "run_copy", "run_head", @@ -60,9 +58,6 @@ __all__ = [ "git_downstream", ] -# see https://github.com/iterative/dvc/issues/3167 -disable_other_loggers() - @pytest.fixture def run_copy(tmp_dir, copy_script, dvc):