Logging to stdout with django under gunicorn

时间:2019-05-31 11:57:21

标签: python django logging gunicorn

I want to log to stdout all Django debug logs, the app is running in gunicorn using Docker.

Django config for logging:

    'version': 1,
    'disable_existing_loggers': True,
    'formatters': {
        'console': {
            'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
            },
    },
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
        },
    },
    'loggers': {
        'django': {
            'handlers': ['console'],
            'level': 'DEBUG',  # change debug level as appropiate
            'propagate': True,
        },
    }
}

And Im starting gunicorn with gunicorn --bind 0.0.0.0:80 --log-level "debug" --capture-output --enable-stdio-inheritance tls.wsgi

0 个答案:

没有答案