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

paddlepaddle 包污染 logging,导致功能不可用 #57165

Open
RedContritio opened this issue Sep 10, 2023 · 6 comments
Open

paddlepaddle 包污染 logging,导致功能不可用 #57165

RedContritio opened this issue Sep 10, 2023 · 6 comments
Assignees
Labels
PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc status/following-up 跟进中 type/bug-report 报bug

Comments

@RedContritio
Copy link
Contributor

bug描述 Describe the Bug

该 bug 曾在 paddleOCR 中提出 绕开的办法,但应当被视为 bug。

最小可复现代码:

import logging
logging.basicConfig(level=logging.INFO)
logging.info('print done')
# log success 1st
import paddle
logging.info('print loss')
# log failed
import logreset
logreset.reset_logging()
logging.basicConfig(level=logging.INFO)
logging.info('print done again')
# log success 2nd

根据代码的 logging.info 次数,理应输出三次,但实际仅输出了两次。
实际结果:

Python 3.10.12 (main, Jun  7 2023, 12:45:35) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> logging.basicConfig(level=logging.INFO)
>>> logging.info('print done')
INFO:root:print done
>>> import paddle
>>> logging.info('print loss')
>>> import logreset
>>> logreset.reset_logging()
>>> logging.basicConfig(level=logging.INFO)
>>> logging.info('print done again')
INFO:root:print done again
>>> 

其他补充信息 Additional Supplementary Information

No response

@RedContritio RedContritio changed the title paddlepaddle 包污染 logging,导致功能不可用 paddlepaddle 包污染 logging,导致功能不可用 Sep 10, 2023
@paddle-bot paddle-bot bot removed the status/new-issue 新建 label Sep 11, 2023
@Bobholamovic
Copy link
Member

你好,感谢你的反馈。这确实是一个影响开发者体验的bug。

我排查到这个问题的根因是paddle.distributed.utils.log_utils提供的get_logger函数使用的name参数默认为"root",而该函数在被调用的时候多次使用了默认参数,这直接影响了root logger的行为。

def get_logger(log_level, name="root"):

一个能够立即想到的解决方案是将name参数的默认值修改为"root"以外的其他值。我们会从影响范围等角度进一步评估这一解决方案是否可行,后续进展仍在此issue回复。

@paddle-bot paddle-bot bot added the PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc label Sep 11, 2023
@Bobholamovic
Copy link
Member

我们会在近期提PR修复这个问题,请关注此issue同步的进展。

@wuhuachaocoding
Copy link
Contributor

image
你好,我们在develop版本中复现上述代码,实际输出的次数是3次,和你预期一样。请使用最新版本paddle试试。

@EvsanDlg
Copy link

EvsanDlg commented Feb 14, 2024

I have python 3.9 and paddlepaddle 2.6.0 installed and still face the issue. Could someone explain what exact commit (probably in dev) fixes it?

@Bobholamovic
Copy link
Member

I have python 3.9 and paddlepaddle 2.6.0 installed and still face the issue. Could someone explain what exact commit (probably in dev) fixes it?

@wuhuachaocoding Can you provide the commit ID?

@zyblog123
Copy link

paddlepaddle 3.0.0rc1仍然存在此问题,上述代码第二次日志仍旧未输出

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc status/following-up 跟进中 type/bug-report 报bug
Projects
None yet
Development

No branches or pull requests

5 participants