Last active
February 27, 2019 10:40
-
-
Save adamshamsudeen/f29ccc3cc0a8d99b76768a708458a6a4 to your computer and use it in GitHub Desktop.
running flask app with all the gunicorn and logging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
app = Flask(__name__) | |
# gunicorn_error_logger = logging.getLogger('gunicorn.error') | |
# app.logger.handlers.extend(gunicorn_error_logger.handlers) | |
# app.logger.setLevel(logging.DEBUG) | |
# app.logger.debug('this will show in the log') | |
# gunicorn_logger = logging.getLogger(‘gunicorn.error’) | |
# app.logger.handlers = gunicorn_logger.handlers | |
# app.logger.setLevel(gunicorn_logger.level) | |
# app.logger.debug('Started Logging') | |
gunicorn_logger = logging.getLogger('gunicorn.error') | |
app.logger.handlers = gunicorn_logger.handlers | |
app.logger.setLevel(gunicorn_logger.level) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gunicorn main:app \ | |
--workers 4 \ | |
--bind 0.0.0.0:8889 \ | |
--log-file logs/gunicorn.log \ | |
--log-level DEBUG \ | |
--reload \ | |
--statsd-host=35.232.203.127:8125 \ | |
--statsd-prefix=mm.ui | |
#using nohup to run and store the log in a ~/.mm_store | |
nohup gunicorn server:app --workers 4 --bind 0.0.0.0:8889 --log-file=- --log-level DEBUG --statsd-host=35.232.203.127:8125 --statsd-prefix=mm.ui > ~/.mm_store/mm.out & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment