Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #12432
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'debug': 0.03; 'handler': 0.04; 'python': 0.08; 'false,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; '"%s"\'': 0.16; "'class':": 0.16; 'confused,': 0.16; 'confused.': 0.16; 'emits': 0.16; 'expected.': 0.16; 'out?': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:t-dialin.net': 0.16; 'roy': 0.16; 'skip:# 30': 0.16; 'subject:logging': 0.16; 'wrote:': 0.16; 'subject:Help': 0.17; 'seems': 0.20; "haven't": 0.20; 'skip:l 30': 0.24; 'tried': 0.26; "i'm": 0.27; 'skip:[ 10': 0.27; 'code,': 0.28; 'import': 0.28; 'replaced': 0.29; "skip:' 30": 0.29; 'true,': 0.29; 'looks': 0.29; 'django': 0.29; 'config': 0.30; 'from:addr:web.de': 0.30; 'skip:% 10': 0.30; "skip:' 10": 0.30; "isn't": 0.33; 'to:addr:python- list': 0.33; 'but,': 0.34; 'header:X-Complaints-To:1': 0.35; 'another': 0.37; 'using': 0.37; 'received:org': 0.38; 'configured': 0.38; 'should': 0.38; 'subject:: ': 0.39; 'getting': 0.39; 'header:Mime-Version:1': 0.39; 'why': 0.39; 'to:addr:python.org': 0.39; 'skip:d 20': 0.39; 'setup': 0.40; 'your': 0.61; 'skip:1 10': 0.63; 'subject:this': 0.74; 'python2.7': 0.84; 'filtered': 0.91; 'url)': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Peter Otten <__peter__@web.de> |
| Subject | Re: Help me understand this logging config |
| Date | Tue, 30 Aug 2011 11:24:44 +0200 |
| Organization | None |
| References | <bdf729a3-5f68-46fb-b6ae-27dceed5af77@18g2000yqu.googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Gmane-NNTP-Posting-Host | p5084b22b.dip.t-dialin.net |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.566.1314696279.27778.python-list@python.org> (permalink) |
| Lines | 119 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1314696279 news.xs4all.nl 2495 [2001:888:2000:d::a6]:41346 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:12432 |
Show key headers only | View raw
Roy Smith wrote:
> I'm using django 1.3 and python 2.6.
Isn't dictConfig() new in 2.7? It looks like that is what you are using...
> My logging config is:
>
>
> LOGGING = {
> 'version': 1,
> 'disable_existing_loggers': False,
> 'formatters': {
> 'verbose': {
> 'format': '%(asctime)s: %(name)s %(levelname)s %
> (funcName)s %(message)s'
> }
> },
> 'handlers': {
> 'mail_admins': {
> 'level': 'ERROR',
> 'class': 'django.utils.log.AdminEmailHandler'
> },
> 'console': {
> 'level': 'DEBUG',
> 'class': 'logging.StreamHandler',
> 'formatter': 'verbose',
> },
> },
> 'loggers': {
> 'django.request': {'handlers': ['mail_admins'],
> 'level': 'ERROR',
> 'propagate': True,
> },
> 'djfront': {'handlers': ['console'],
> 'propagate': True,
> },
> 'djfront.view': {'level': 'INFO'},
> 'djfront.auth': {'level': 'INFO'},
> 'djfront.auth.user': {'level': 'INFO'},
> 'djfront.api': {'level': 'WARN'},
> }
> }
>
> In my code, I do:
>
> logger = logging.getLogger('djfront.auth.facebook')
>
> Since I haven't configured a 'djfront.auth.facebook' logger, it should
> inherit the 'djfront.auth' config, which means the logging level
> should be set to INFO. But, when I do:
>
> logger.debug('redirecting to "%s"' % url)
>
> it emits a message:
>
> 2011-08-29 13:31:03,321: djfront.auth.facebook DEBUG oauth_init
> redirecting to [...]
>
> I'm confused. Why is the debug level message not getting filtered
> out?
I tried your setup with the django-specific handler replaced by another
StreamHandler
$ cat tmp_logging.py
import logging
import logging.config
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(asctime)s: %(name)s %(levelname)s %(funcName)s
%(message)s'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'logging.StreamHandler'
#'django.utils.log.AdminEmailHandler'
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
},
'loggers': {
'django.request': {'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
'djfront': {'handlers': ['console'],
'propagate': True,
},
'djfront.view': {'level': 'INFO'},
'djfront.auth': {'level': 'INFO'},
'djfront.auth.user': {'level': 'INFO'},
'djfront.api': {'level': 'WARN'},
}
}
logging.config.dictConfig(LOGGING)
logger = logging.getLogger('djfront.auth.facebook')
logger.info("info-test")
logger.debug("debug-test")
and got what
$ python2.7 tmp_logging.py
2011-08-30 11:18:33,160: djfront.auth.facebook INFO <module> info-test
$
which seems to be what you expected. So I'm confused, too...
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Help me understand this logging config Roy Smith <roy@panix.com> - 2011-08-29 10:53 -0700
Re: Help me understand this logging config Peter Otten <__peter__@web.de> - 2011-08-30 11:24 +0200
Re: Help me understand this logging config Roy Smith <roy@panix.com> - 2011-08-30 08:39 -0400
Re: Help me understand this logging config Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2011-09-02 02:56 -0700
Re: Help me understand this logging config Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2011-09-02 09:58 +0000
Re: Help me understand this logging config Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2011-09-02 03:00 -0700
Re: Help me understand this logging config anand jeyahar <anand.ibmgsi@gmail.com> - 2011-08-30 17:01 +0530
csiph-web