Re: log doesn't work

22 views
Skip to first unread message

Shu Lin

unread,
Apr 28, 2013, 3:09:07 AM4/28/13
to paste...@googlegroups.com
I basically identified it is a paste parsing ini file problem since if I put below into code, things start working:


import logging

log = logging.getLogger(__name__)

log.setLevel(logging.INFO)


But, we can see, in the ini file, I have set log level at least to INFO level for every module.

What's the problem of ini file parsing? How to debug it?

Thanks a lot,
-Shu

On Thursday, April 25, 2013 9:57:24 PM UTC-7, Shu Lin wrote:

Hi,

The debug log doesn't work for dependent libraries suddenly. The log still works for the main project, in this case, it is "crossbow_py". But, not for sqlalchemy anymore. What's wrong with my configuration? Below is my development.ini.

Thanks a lot,

-Shu

===

[app:main]

use = egg:crossbow_py

reload_templates = true

debug_authorization = true

debug_notfound = false

debug_routematch = false

debug_templates = false

default_locale_name = en

jinja2.directories = crossbow_py:templates

pyramid.includes =

    pyramid_jinja2

    pyramid_debugtoolbar

    pyramid_tm

debugtoolbar.hosts = 0.0.0.0/0


sqlalchemy.url = sqlite:///%(here)s/crossbow.sqlite


session.type = cookie

session.key = crossbow

session.encrypt_key = mysecretencryptionkey

session.validate_key = mysecretvalidationkey

session.cookie_on_exception = true


[server:main]

use = egg:pyramid#wsgiref

host = 0.0.0.0

port = 8080


# Begin logging configuration


[loggers]

keys = root, crossbow_py, sqlalchemy


[handlers]

keys = console, filelog


[formatters]

keys = generic


[logger_root]

level = INFO

handlers = console, filelog


[logger_crossbow_py]

level = DEBUG

handlers = 

qualname = crossbow_py


[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


[handler_filelog]

class = FileHandler

args = ('%(here)s/crossbow.log','a')

level = NOTSET

formatter = generic


[formatter_generic]

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


# End logging configuration

Taavi Burns

unread,
Apr 28, 2013, 7:13:57 AM4/28/13
to Shu Lin, paste...@googlegroups.com
If you're having issues with log messages and levels etc, I highly recommend Brandon Rhodes' logging_tree module:

Python's logging is a complex beast; there are talks on it at every PyCon I've been at.

Good luck!

-- 
taa
/*eof*/
--
You received this message because you are subscribed to the Google Groups "Paste Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to paste-users...@googlegroups.com.
To post to this group, send email to paste...@googlegroups.com.
Visit this group at http://groups.google.com/group/paste-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Shu Lin

unread,
Apr 30, 2013, 2:17:56 AM4/30/13
to paste...@googlegroups.com, Shu Lin
Taavi,

The logging tree really helps on understanding of the log. Now, I know the logging is really a beast.

Thanks a lot,
-Shu
Reply all
Reply to author
Forward
0 new messages