Skip to content

Commit

Permalink
run initLogging unconditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
kba committed Nov 20, 2024
1 parent c0f6116 commit a8643c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ocrd_utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
1 change: 1 addition & 0 deletions tests/cli/test_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def _get_log_output(self, *args):

def setUp(self):
super().setUp()
disableLogging()
initLogging()

def tearDown(self):
Expand Down

0 comments on commit a8643c5

Please sign in to comment.