Skip to content

Use named logger instead of modifying root logger#17684

Merged
luotao1 merged 2 commits intoPaddlePaddle:mainfrom
Mr-Neutr0n:fix-root-logger
Feb 28, 2026
Merged

Use named logger instead of modifying root logger#17684
luotao1 merged 2 commits intoPaddlePaddle:mainfrom
Mr-Neutr0n:fix-root-logger

Conversation

@Mr-Neutr0n
Copy link
Contributor

Summary

  • Replace logging.basicConfig(level=logging.INFO) with a named logger (logging.getLogger("ppocr")) in configs/rec/multi_language/generate_multi_language_configs.py
  • Replace all logging.info(...) calls with logger.info(...) to use the named logger instead of the root logger
  • This prevents PaddleOCR from mutating the Python root logger and overriding user application logging configuration

Fixes #17344

Test plan

  • Verify that generate_multi_language_configs.py still logs correctly when run directly
  • Verify that importing or using PaddleOCR no longer modifies the root logger level
  • Confirm user-configured logging (e.g. logging.basicConfig(level=logging.WARNING)) is preserved after PaddleOCR initialization

Replace logging.basicConfig() and logging.info() calls with a named
logger (logging.getLogger("ppocr")) in generate_multi_language_configs.py
to avoid mutating the Python root logger and overriding user logging
configuration.

Fixes PaddlePaddle#17344
@paddle-bot
Copy link

paddle-bot bot commented Feb 9, 2026

Thanks for your contribution!

@CLAassistant
Copy link

CLAassistant commented Feb 9, 2026

CLA assistant check
All committers have signed the CLA.

@Mr-Neutr0n
Copy link
Contributor Author

recheck

Copy link
Collaborator

@GreatV GreatV left a comment

Choose a reason for hiding this comment

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

LGTM

@luotao1 luotao1 merged commit 2779dad into PaddlePaddle:main Feb 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PaddleOCR() initialization modifies Python root logger level (to WARNING) on Windows

5 participants