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

How to setup logger for GUnicorn? #115

Description

@epicGeek
  • 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions