Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #3498

logger warning doesn't appear even though propagate flag is True

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <discmagnet@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.078
X-Spam-Evidence '*H*': 0.85; '*S*': 0.00; 'prints': 0.07; 'received:74.125.82.174': 0.12; 'received:mail- wy0-f174.google.com': 0.12; 'skip:[ 20': 0.12; 'defined': 0.15; '%h:%m:%s': 0.16; 'appear': 0.19; 'skip:k 20': 0.23; 'skip:# 10': 0.25; 'skip:l 30': 0.25; 'skip:[ 10': 0.26; 'message- id:@mail.gmail.com': 0.28; "doesn't": 0.28; 'skip:% 10': 0.31; 'second': 0.31; 'however,': 0.31; 'import': 0.32; 'to:addr:python- list': 0.32; 'file': 0.35; 'logging': 0.38; 'received:google.com': 0.38; 'explain': 0.39; 'to:addr:python.org': 0.39; 'could': 0.39; 'header:Received:5': 0.40; 'skip:h 20': 0.60; 'as:': 0.64; 'python2.7': 0.84; 'subject:even': 0.84; 'subject:though': 0.84; 'subject:warning': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=p65rCCWlIkCossmQxoSQAEA3ECcOGh/2oPRZ2IU6uK8=; b=gEoLZcT+3Cx/0LNmsEid0NpG6kz/3cfMzhSzYA+piSUa7PgCcq6nrS7on3np6Xo6yA ro1rUSsYBJG+Rgv2An9/MWSZI+YgH12Ai0aNHyWBUIp9+rnsSw0O7rsecezDo6Mtu/ZC sqymOsBXdbkZ6zvtU3J2ilqY1HEzMu6Els4R0=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=TWGbn2ZzJG7xOF1A/OXRp0MYJcOWXapt/5z8UENbvhOJC2jgAxOR3hfhd4T1pydgVY +MYB9cCo/GwgGjuzd46frkF7zwcxFevcwNCO5BFRp3K4tVwFBaLnUHktZX9Wp/anCM9x 4NtTkgfwfU/q5BnbueGtzn2TD4B9MuRmwc9no=
MIME-Version 1.0
Date Tue, 19 Apr 2011 01:33:49 +0530
Subject logger warning doesn't appear even though propagate flag is True
From Disc Magnet <discmagnet@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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.522.1303157031.9059.python-list@python.org> (permalink)
Lines 60
NNTP-Posting-Host 82.94.164.166
X-Trace 1303157031 news.xs4all.nl 81478 [::ffff:82.94.164.166]:34138
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:3498

Show key headers only | View raw


This program prints both the warnings:

#!/usr/bin/env python2.7

import logging
import logging.config

logging.config.fileConfig('log.conf')

log1 = logging.getLogger()
log2 = logging.getLogger('foo.bar')
log2.addHandler(logging.NullHandler())

log1.warn('warning 1')
log2.warn('warning 2')

However, this prints only the first warning:

#!/usr/bin/env python2.7

import logging
import logging.config

log2 = logging.getLogger('foo.bar')
logging.config.fileConfig('log.conf')

log1 = logging.getLogger()
log2.addHandler(logging.NullHandler())

log1.warn('warning 1')
log2.warn('warning 2')

My log.conf file is defined as:


[loggers]
keys=root

[handlers]
keys=consoleHandler

[formatters]
keys=simpleFormatter

[logger_root]
level=DEBUG
handlers=consoleHandler

[handler_consoleHandler]
class=StreamHandler
level=DEBUG
formatter=simpleFormatter
args=(sys.stdout,)

[formatter_simpleFormatter]
format=%(asctime)s %(name)s %(levelname)s - %(message)s
datefmt=%Y-%m-%d %H:%M:%S

Could you please explain why the second warning doesn't appear in the
second program?

Back to comp.lang.python | Previous | Next | Find similar


Thread

logger warning doesn't appear even though propagate flag is True Disc Magnet <discmagnet@gmail.com> - 2011-04-19 01:33 +0530

csiph-web