Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

引用PaddleOCR模块后会导致logging的默认logger中添加一项haddler #13122

Open
ireson96 opened this issue Jun 18, 2024 · 5 comments
Open
Labels
enhancement functionality enhancement recommendations

Comments

@ireson96
Copy link

ireson96 commented Jun 18, 2024

问题描述 / Problem Description

在引用PaddleOCR模块后会导致logging的默认logger中添加一项haddler,具体现象如下图所示:
image

运行环境 / Runtime Environment

  • OS: win11
  • Paddle: 2.6.1
  • PaddleOCR: 2.7.3

复现代码 / Reproduction Code

from paddleocr import PaddleOCR

完整报错 / Complete Error Message

会导致其他模块在打印日志的时候控制台多打印预期外的一条日志例如下图:
image

可能解决方案 / Possible solutions

倒是可以通过在初始化logger的时候手动清空一遍默认的haddler来解决这个问题,但考虑到并不是所有情况下logger的初始化都在引用PaddleOCR之后,还是建议将PaddleOCR初始化时添加的haddler添加到对应模块名下

附件 / Appendix

@GreatV
Copy link
Collaborator

GreatV commented Jun 18, 2024

你可以提一个PR来修复这个问题吗?

@ireson96
Copy link
Author

可以 不过跟踪了下是paddle库的命名问题,我不是很确定是不是特意设计成这样的
image

@ireson96
Copy link
Author

paddle/distributed/utils/log_utils.py

@GreatV
Copy link
Collaborator

GreatV commented Jun 18, 2024

paddleocr 里也有一个 get_logger https://github.com/PaddlePaddle/PaddleOCR/blob/main/ppocr/utils/logging.py ,是不是可以改成 paddleocr里的 get_logger

@ireson96
Copy link
Author

paddleocr 里也有一个 get_logger https://github.com/PaddlePaddle/PaddleOCR/blob/main/ppocr/utils/logging.py ,是不是可以改成 paddleocr里的 get_logger

这样的改动会比较大吧 毕竟两个get_logger的参数都并不太相同

@GreatV GreatV added the enhancement functionality enhancement recommendations label Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement functionality enhancement recommendations
Projects
None yet
Development

No branches or pull requests

2 participants