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

When starting the project in local, logs and debugging mode are not accessible anymore #2445

Closed
karlcow opened this issue May 9, 2018 · 4 comments

Comments

@karlcow
Copy link
Member

karlcow commented May 9, 2018

Before when we were starting the project locally, the logs were displayed on the terminal,
and we were given a PIN number for debugging live.

This is not happening anymore.

@karlcow
Copy link
Member Author

karlcow commented May 20, 2018

To clarify this is a regression. We should have something like more or less:

 * Forcing debug mode on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 861-432-160

Plus the message about initializing milestones.

This above was the result of running FLASK_DEBUG=1 flask run instead of python run.py.

@karlcow
Copy link
Member Author

karlcow commented May 20, 2018

FLASK_DEBUG=1 FLASK_APP=run.py flask run
 * Serving Flask app "run"
 * Forcing debug mode on
Statuses Initialization…
Fetching milestones from Github…
Milestones saved in data/
Milestones in memory
Statuses Initialization…
Fetching milestones from Github…
Milestones saved in data/
Milestones in memory

karlcow added a commit to karlcow/webcompat.com that referenced this issue May 22, 2018
@karlcow
Copy link
Member Author

karlcow commented May 22, 2018

ok understood.
The culprit was basically these lines.

logging.basicConfig(
filename=LOG_FILE,
format='%(levelname)s %(asctime)s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')

Flask has loggers quite hardcoded and anything simple you do has a tendency to break the rest of logging.

So I remove the logging for now and switched to print statements for milestones.
We will need a way to figure out to make this work in a smoother more elegant way.

This comment gives good information about the whys
https://stackoverflow.com/questions/17743019/flask-logging-cannot-get-it-to-write-to-a-file#answer-47808630

@miketaylr
Copy link
Member

Thanks for figuring this out @karlcow. There were some changes to how logging works in Flask 1.0, I don't know how or if it is useful in this instance: pallets/flask#2436

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

No branches or pull requests

2 participants