Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

How to setup logger for GUnicorn? #115

Open
epicGeek opened this issue Jul 19, 2018 · 0 comments
Open

How to setup logger for GUnicorn? #115

epicGeek opened this issue Jul 19, 2018 · 0 comments

Comments

@epicGeek
Copy link

  • logzero version: 1.5.0
  • Python version: 2.7.14
  • Operating System: Debian

Description

I am running a flask app behind a gunicorn in a docker container.
But I have no idea how to make logzero to get the gunicorn log in the log file

What I Did

Here is my code:

def get_logger():
    from spa_manager import spa_config
    logger_format = spa_config["LOGGER_FORMAT"]
    logger_abs_path = spa_config["LOGGER_ABS_PATH"]
    logzero.logfile(logger_abs_path, maxBytes=5*1024*1024, backupCount=10)
 # I setup sqlalchemy logger to record SQL info. It works.
    logzero.setup_logger(name="sqlalchemy.engine", logfile=logger_abs_path, formatter=logging.Formatter(spa_config["LOGGER_FORMAT"]))
# Here I tried to setup gunicorn log , not work.
    logzero.setup_logger(name="gunicorn.error", logfile=logger_abs_path, formatter=logging.Formatter(spa_config["LOGGER_FORMAT"]))
    formatter = logging.Formatter(logger_format)
    logzero.formatter(formatter)
    return logger
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant