I am hoping to create two types of logs:
access.log: lists all requests made on the flask applicationerror.log: lists all warnings, and errors made within the flask applicationCurrently, I have defined app.py, which contains logic recycled from a gist comment:
import logging
from logging.handlers import RotatingFileHandler
from interface import app
app.run(host='0.0.0.0')
LOG_FILENAME = '/vagrant/log/access.log'
formatter = logging.Formatter(
"[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s")
handler = RotatingFileHandler(LOG_FILENAME, maxBytes=10000000, backupCount=5)
handler.setLevel(logging.DEBUG)
handler.setFormatter(formatter)
app.logger.addHandler(handler)
log = logging.getLogger('werkzeug')
log.setLevel(logging.DEBUG)
log.addHandler(handler)
When I adjust my application, by making an unnecessary typo in the logic; or conversely, if I complete a successful post request on my application, nothing gets logged into /vagrant/log/access.log. However, the /vagrant/log/access.log file is created, and empty. Is the above logic equivalent to the error.log that I had intended? If so, how can I correct this, while also creating a functional /vagrant/log/access.log?
Please take this to StackOverflow.