I have been trying to get my Flask app to log to a log file. In elastic beanstalk I have a logger in my flask app that logs files to
opt/python/log
The file is successfully created but when I try to do something like
log.warning('ERROR')
The line does not show up correctly. I have tested to make sure my logger works correctly on localhost. I have read many stack overflow responses and believe it's a permissions issue, however when I try adding
commands:
01_change_permissions:
command: chmod g+s /opt/python/log
02_change_owner:
command: chown root:wsgi /opt/python/log
to
.ebextensions
Or even something like
files:
"/opt/elasticbeanstalk/tasks/taillogs.d/history.conf" :
mode: "000755"
owner: root
group: root
content: |
/opt/log/python/history.log
Nothing seems to work. Any help would be appreciated!
Read the docs.
I think you should use logger like:
app.logger.warning('ERROR')
.