Failed to view gunicorn -paster log messages

I run gunicorn with the option --pasterto run Pyramid.

gunicorn -w 1 --paster development.ini

gunicorn's own messages appear on the console, for example

2014-02-20 22:38:50 [44201] [INFO] Starting gunicorn 18.0
2014-02-20 22:38:50 [44201] [INFO] Listening at: http://0.0.0.0:6543 (44201)
2014-02-20 22:38:50 [44201] [INFO] Using worker: sync

However, the log messages in my Pyramid application are not displayed.

If I use pserve development.inione that uses waitressas a WSGI server, the log messages displayed on the console are just fine.

My development.iniincludes a pretty vanilla log configuration configuration.

[loggers]
keys = root, apipython

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console

[logger_apipython]
level = DEBUG
handlers =
qualname = apipython

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = DEBUG
formatter = generic

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s

I get lost why magazines do not appear when I use gunicorn.

+4
source share
2 answers

pserve gunicorn, , , .

Gunicorn "logconfig" , :

gunicorn -w 1 --paster development.ini --log-config development.ini

:

[server:main]
use = egg:gunicorn#main
logconfig = %(here)s/development.ini
+2

- , "pserve" , . "gunicorn --paster" . , :

from pyramid.config import Configurator
from pyramid.paster import setup_logging

def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application. """
    setup_logging(global_config['__file__'])
    config = Configurator(settings=settings)
    # Configure application 
    return config.make_wsgi_app()

, , "pserve":

[server:main]
use = egg:gunicorn#main 
+1

Source: https://habr.com/ru/post/1528045/


All Articles