diff --git a/src/ocrd_utils/logging.py b/src/ocrd_utils/logging.py index addd1cfca..7fede27c9 100644 --- a/src/ocrd_utils/logging.py +++ b/src/ocrd_utils/logging.py @@ -205,3 +205,8 @@ def disableLogging(silent=not config.OCRD_LOGGING_DEBUG): # Python default log level is WARNING logging.root.setLevel(logging.WARNING) +# Initialize logging now to prevent any other libraries (tensorflow, +# matplotlib ...) from adding their own root handler, which might mangle the +# STDOUT (our logging will log to STDERR so as not to interfere with +# --dump-json etc.) +initLogging() diff --git a/tests/cli/test_log.py b/tests/cli/test_log.py index 3d81e8266..25db78f5e 100644 --- a/tests/cli/test_log.py +++ b/tests/cli/test_log.py @@ -24,6 +24,7 @@ def _get_log_output(self, *args): def setUp(self): super().setUp() + disableLogging() initLogging() def tearDown(self):