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

2024.1 display clobbered with internal pudb [DEBUG] messages. #649

Closed
cederom opened this issue Apr 29, 2024 · 11 comments
Closed

2024.1 display clobbered with internal pudb [DEBUG] messages. #649

cederom opened this issue Apr 29, 2024 · 11 comments
Labels

Comments

@cederom
Copy link

cederom commented Apr 29, 2024

Describe the bug

  • On macOS for some reason pudb seems to use DEBUG loglevel. I could not find any info on how to disable that.
  • This results in display being clobbered with internal pudb [DEBUG] messages (i.e. pudb waited for something etc).
  • This happens when navigating over the code, variables, etc - [DEBUG] messages of pudb are displayed over the debugger screen making things unreadable.

To Reproduce
Steps to reproduce the behavior:

  1. Create python venv.
  2. pip install pudb.
  3. insert import pudb; pu.db in your application.
  4. run the application trigger the debugger.
  5. see that each arrow key press results in additional [DEBUG] messages overwriting the screen.

Expected behavior

  • No [DEBUG] messages shows up so pudb can be used.

Screenshots
pudb-problem-20240429

Additional context

  • No problem like this on FreeBSD.

Versions

  • pudb 2024.1 (also tried with recent master and previous releases no change).
  • Python 3.11.9.
  • macOS 14.4.1.
  • brew 4.2.19-131.
@cederom cederom added the Bug label Apr 29, 2024
@cederom cederom changed the title pudb inherits loglevel from debugged application / display clobbered with internal pudb [DEBUG] messages. 2024.1 display clobbered with internal pudb [DEBUG] messages. Apr 29, 2024
@inducer
Copy link
Owner

inducer commented Apr 29, 2024

That's a fair point. We should probably call catch_warnings on entry to the UI, then resetwarnings, and then override showwarning to direct Pudb's own log messages to its built-in console.

PRs implementing this would be welcome.

@cederom
Copy link
Author

cederom commented Apr 29, 2024

Or just add --log-level switch / setting? :-)

@inducer
Copy link
Owner

inducer commented Apr 29, 2024

I mean, we really need to keep pudb's log level separate from that of the application, despite both of them running with the same Python runtime.

@inducer
Copy link
Owner

inducer commented Apr 29, 2024

Huh, I just realized I am talking about warnings, while you are talking about logging. The two are distinct, and both need handling.

@inducer
Copy link
Owner

inducer commented Apr 29, 2024

#650 handles the warning end of this.

@cederom
Copy link
Author

cederom commented Apr 29, 2024

Negative :-( still here :-( Its like loglevel DEBUG is enabled somehow o_O

pudb-problem-20240429-2

@inducer
Copy link
Owner

inducer commented Apr 29, 2024

Sure. #650 was never going to help with logging, only warnings, sorry. PRs still welcome.

@cederom
Copy link
Author

cederom commented Apr 29, 2024

Okay, this is caused by the Kivy framework that I use attaching to a root logger by default [1] thus also capturing pudb logger that also seems to attach to the root logger. Quck fix is to use PYTHON or MIXED mode in Kivy logger when working with pudb.

[1] https://github.com/kivy/kivy/blob/4a8caf561c37944a21bc004bf8faae2d8237e8a1/kivy/logger.py#L78

@cederom cederom closed this as completed Apr 29, 2024
@pjkersten
Copy link

Ran into this while debugging a Flask app on linux. Would it be possible to ignore the logger.basicConfig settings to prevent this from happening?

@inducer
Copy link
Owner

inducer commented May 14, 2024

The approach I would prefer would be to swap out the logging configuration for one that logs to pudb's built-in console while the UI is active, similar to #650. Not at the top of my list, but PRs definitely still welcome.

@cederom
Copy link
Author

cederom commented May 14, 2024

Ran into this while debugging a Flask app on linux. Would it be possible to ignore the logger.basicConfig settings to prevent this from happening?

The problem is using root logger by both pudb and your application (Python uses object references not copies). In my case (Kivy) it was possible to change application behavior not to capture and dump everything from the root logger (see description above). That solved clobbered display for me. I guess Flask can be configured in a similar way but I have no experience with Flask sorry.

I guess the best solution would be setting up some sort of internal logger (handler) dedicated for pudb and use its output only in built-in console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants