Saturday, 26 August 2023

Flask server won't start when I include logging.basicConfig(filename='whatever.log')

I have a flask app in which I'm implementing logging into a file. The code is as follows:

from flask import request, Flask
import os
from werkzeug.utils import secure_filename
import logging

app = Flask(__name__)

logging.basicConfig(filename='fileStorage.log', level=logging.DEBUG)                                                                                                                                       

print('helloworld')

When I enter >flask run I get the following response:

* Serving Flask app "PostData.py"
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
helloworld

For some reason, the text * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) Doesn't appear. It will appear, however, if I don't set the 'filename' parameter in logging.basicConfig

What am I missing here?



from Flask server won't start when I include logging.basicConfig(filename='whatever.log')

No comments:

Post a Comment