Logging to console with Pyramid pshell
Question: In the process of developing a Pyramid web application, I've found it very
useful to use the command-line `pshell` to load the application and interact
with various code. However, log statements are not echoed on the console, and
I'm not sure why.

For instance, lets say in `common.utilities.general` I have a function:

    
    
    import logging
    
    log = logging.getLogger(__name__)
    
    def my_util():
        log.debug("Executing utility.")
        return "Utility was executed."
    

Then in my command line:

    
    
    (pyenv)rook:swap nateford$ pshell src/local.ini 
    2015-10-08 14:44:01,081 INFO  [common.orm.pymongo_core][MainThread] PyMongo Connection to replica set successful: localhost:27017
    2015-10-08 14:44:01,082 INFO  [common.orm.pymongo_core][MainThread] Connected to Mongo Database = turnhere
    Python 3.4.3 (default, Mar 10 2015, 14:53:35) 
    [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
    Type "help" for more information.
    
    Environment:
      app          The WSGI application.
      registry     Active Pyramid registry.
      request      Active request object.
      root         Root of the default resource tree.
      root_factory Default root factory used to create `root`.
    
    >>> from common.utilities.general import my_util
    >>> my_util()
    'Utility was executed.'
    >>> 
    

As you can see, there is no log to the console. I would expect:

    
    
    >>> from common.utilities.general import my_util
    >>> my_util()
    [some date/server info][DEBUG]: Executing utility.
    'Utility was executed.'
    >>> 
    

Here is the (relevant) contents of my `local.ini` file:

    
    
    <Various elided application settings>
    ###
    # logging configuration
    # http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/narr/logging.html
    ###
    
    [loggers]
    keys = root, common, webapp, services, sqlalchemy
    
    [handlers]
    keys = console, applog
    
    [formatters]
    keys = generic
    
    [logger_root]
    level = INFO
    handlers = console, applog
    
    [logger_common]
    level = DEBUG
    handlers =
    qualname = common
    
    [logger_services]
    level = DEBUG
    handlers =
    qualname = common.services
    
    [logger_webapp]
    level = DEBUG
    handlers =
    qualname = webapp
    
    [logger_sqlalchemy]
    level = WARN
    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 = DEBUG
    formatter = generic
    
    [handler_applog]
    class = FileHandler
    args = (r'%(here)s/log/app.log','a')
    level = NOTSET
    formatter = generic
    
    [formatter_generic]
    format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
    


Answer: Your root's logger logging level is set `INFO` which is higher level than
`DEBUG` which is the level you log your messages with. Changing root's logger
level to `DEBUG` should help.

