diff --git a/dvc/logger.py b/dvc/logger.py index ecd115a7cf..88aec12e0c 100644 --- a/dvc/logger.py +++ b/dvc/logger.py @@ -141,6 +141,13 @@ def _stack_trace(exc_info): ) +def disable_other_loggers(): + root = logging.root + for (logger_name, logger) in root.manager.loggerDict.items(): + if logger_name != "dvc" and not logger_name.startswith("dvc."): + logger.disabled = True + + def setup(level=logging.INFO): colorama.init() @@ -183,22 +190,7 @@ def setup(level=logging.INFO): "console_errors", ], }, - "paramiko": { - "level": logging.CRITICAL, - "handlers": [ - "console_info", - "console_debug", - "console_errors", - ], - }, - "flufl.lock": { - "level": logging.CRITICAL, - "handlers": [ - "console_info", - "console_debug", - "console_errors", - ], - }, }, + "disable_existing_loggers": False, } ) diff --git a/dvc/main.py b/dvc/main.py index cc4fe38aa9..9caaedd290 100644 --- a/dvc/main.py +++ b/dvc/main.py @@ -9,7 +9,7 @@ from dvc.exceptions import DvcParserError from dvc.exceptions import NotDvcRepoError from dvc.external_repo import clean_repos -from dvc.logger import FOOTER +from dvc.logger import disable_other_loggers, FOOTER from dvc.utils import format_link from dvc.remote.pool import close_pools @@ -34,6 +34,7 @@ def main(argv=None): """ args = None cmd = None + disable_other_loggers() outerLogLevel = logger.level try: diff --git a/tests/dir_helpers.py b/tests/dir_helpers.py index 158bb20531..0604099bb9 100644 --- a/tests/dir_helpers.py +++ b/tests/dir_helpers.py @@ -45,12 +45,12 @@ import os import pathlib -import logging from contextlib import contextmanager import pytest from funcy import lmap, retry +from dvc.logger import disable_other_loggers from dvc.utils.fs import makedirs from dvc.compat import fspath, fspath_py35 @@ -67,8 +67,7 @@ # see https://github.com/iterative/dvc/issues/3167 -git_logger = logging.getLogger("git") -git_logger.setLevel(logging.CRITICAL) +disable_other_loggers() class TmpDir(pathlib.Path):