python - Cannot get logging to work when running Pyramid app with uwsgi -


i have pyramid application, works fine, when started via pserve or via uwsgi. when started via pserve, logging setup works fine, not when started via uwsgi. uwsgi section of paster ini looks this:

[uwsgi] socket = 127.0.0.1:3099 master = true processes = 1 virtualenv = /opt/data/virtualenvs/some_virtual_env paste = config:%p paste-logger = true buffer-size = 65535 

i found of course this question , tried configure logger this:

paste-logger = %p 

but not work. logging config using absolute path , target folder of log file allows reading , writing everybody. wonder little bit how specify paste-logger, because has no argument according documentation.

the command line configuration upstart defined this:

exec uwsgi --master --die-on-term --emperor /etc/uwsgi/apps-enabled 

no custom log files created , in uwsgi log don't see helpful messages or errors. how logging working or debug problem appreciated.

this not asked about, following works me on ubuntu.

i use default logging configuration provided pyramid templates, streams logs stderr:

# begin logging configuration  [loggers] keys = root, myapp  [handlers] keys = console  [formatters] keys = generic  [logger_root] level = info handlers = console  [logger_myapp] level = debug handlers = qualname = myapp  [handler_console] class = streamhandler args = (sys.stderr,) level = notset formatter = generic  [formatter_generic] format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadname)s] %(message)s  # end logging configuration 

each uwsgi application in ubuntu has own config file, should placed in /etc/uwsgi/apps-enabled/ directory. here myapp.ini example:

[uwsgi] plugin = python virtualenv = /path/to/myapp/virutalenv paste = config:/path/to/myapp/config.ini 

so when run application using pserve command logs in console. when run using uwsgi, uwsgi create output logs /var/log/uwsgi/app/myapp.log

update

i dug around uwsgi configs , found place, log file location set up. uwsgi init.d scripts use daemonize argument:

--daemonize "/var/log/uwsgi/${confnamespace}/${confname}.log" 

update 2

it may helpful in case explicitly setup logging in application:

from pyramid.paster import setup_logging  setup_logging("/path/to/config.ini") 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -