Skip to content

run initLogging unconditionally#1295

Closed
kba wants to merge 1 commit intomasterfrom
unconditional-initLogging
Closed

run initLogging unconditionally#1295
kba wants to merge 1 commit intomasterfrom
unconditional-initLogging

Conversation

@kba
Copy link
Copy Markdown
Member

@kba kba commented Nov 20, 2024

As discussed in the Tech Call today, we do still need to call initLogging to prevent other modules from adding handlers that might interfere with STDOUT.

And the tests/cli/test_log.py needs to call disableLogging before the first initLogging because otherwise pytest will highjack the logging :/

@kba kba requested a review from bertsky November 20, 2024 16:12
Comment thread src/ocrd_utils/logging.py
# 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()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's not what I meant. See #1223 (comment)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we could still do initLogging on the module level, though not in ocrd_utils.logging but rather ocrd.decorators, which arguably will only be imported by applications that do need log handlers.

@kba kba closed this Nov 21, 2024
@kba kba deleted the unconditional-initLogging branch November 21, 2024 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants