Logging prevents Flask application from starting
up vote
0
down vote
favorite
I am using the hello world version of Flask. I would like to add logging to a file. When I add the following line, the Flask app never starts:
logging.basicConfig(filename=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'errors.txt'),
level=logging.ERROR)
Full code:
import logging
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
logging.basicConfig(filename=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'errors.txt'),
level=logging.ERROR)
app.run()
python-2.7 logging flask
add a comment |
up vote
0
down vote
favorite
I am using the hello world version of Flask. I would like to add logging to a file. When I add the following line, the Flask app never starts:
logging.basicConfig(filename=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'errors.txt'),
level=logging.ERROR)
Full code:
import logging
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
logging.basicConfig(filename=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'errors.txt'),
level=logging.ERROR)
app.run()
python-2.7 logging flask
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am using the hello world version of Flask. I would like to add logging to a file. When I add the following line, the Flask app never starts:
logging.basicConfig(filename=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'errors.txt'),
level=logging.ERROR)
Full code:
import logging
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
logging.basicConfig(filename=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'errors.txt'),
level=logging.ERROR)
app.run()
python-2.7 logging flask
I am using the hello world version of Flask. I would like to add logging to a file. When I add the following line, the Flask app never starts:
logging.basicConfig(filename=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'errors.txt'),
level=logging.ERROR)
Full code:
import logging
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
logging.basicConfig(filename=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'errors.txt'),
level=logging.ERROR)
app.run()
python-2.7 logging flask
python-2.7 logging flask
asked 12 hours ago
user2242044
2,00563984
2,00563984
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416120%2flogging-prevents-flask-application-from-starting%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown