On Sep 11, 2012, at 3:41 PM, Vlad K. wrote:

> 
> Hi all,
> 
> I'm having a bit of an issue with logging. I did this (a trick I picked up 
> from a site to enable logging under uwsgi):
> 
> 
> __init__.py
> --------------------
> def main(global_config, **settings):
>     """ Main WSGI application.
>     """
>     logging.config.fileConfig(settings["logging.config"])
> ....
> 
> 
> development.ini
> --------------------
> logging.config = %(here)s/development.ini
> 
> ...
> 
> 
> # Begin logging configuration
> 
> [loggers]
> keys = root,sqlalchemy
> 
> [handlers]
> keys = console
> 
> [formatters]
> keys = generic
> 
> [logger_root]
> level = DEBUG
> handlers = console
> 
> [logger_sqlalchemy]
> level = INFO
> handlers =
> qualname = sqlalchemy.engine
> # "level = INFO" logs SQL queries.
> # "level = DEBUG" logs SQL queries and results.
> # "level = WARN" logs neither.  (Recommended for production systems.)
> 
> [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
> 
> Now, if I include logging.config.fileConfig() line in __init__ I have to 
> specifically enable loggers for namespaces in development.ini, the root 
> logger won't catch all. For example, I've disabled debugtoolbar in dev, and 
> in case of exceptions I get nothing on the console unless I add a 
> [logger_waitress] section (with logger key set, qualname, etc...).
> 
> If I remove that line (basically, disable logging configuration), logging 
> under Waitress shows root logger catching all (that is not overriden).
> 
> 
> What am I doing wrong?

It's not apparent to me what's wrong. With a root logger set to DEBUG you 
should probably be seeing those messages. You may want to try using the 
logging_tree package as a visual aid:

http://pypi.python.org/pypi/logging_tree

--
Philip Jenvey

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to