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

why can't i see the 'print' #2084

Closed
CoolCaicaixian opened this issue May 23, 2024 · 2 comments
Closed

why can't i see the 'print' #2084

CoolCaicaixian opened this issue May 23, 2024 · 2 comments
Labels

Comments

@CoolCaicaixian
Copy link

截屏2024-05-23 18 43 37 👆
@CoolCaicaixian
Copy link
Author

use current_app.logger.info can see the log.
but why print can not ?

@jamescurtin jamescurtin added question and removed bug labels May 24, 2024
@jamescurtin
Copy link
Collaborator

print output to stdout is probably being buffered. In general, using the logger is the preferred option, but if printing needed, you have a few options:

  1. Set the PYTHONUNBUFFERED environment variable
  2. Manually flush: print("foo", flush=True)
  3. Print to stderr instead of stdout, as it doesn't get buffered import sys; print("foo", file=sys.stderr)

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

2 participants