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


Groups > comp.lang.python > #20620

Re: logging with logging.config.fileConfig

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <prvs=390761ace=jeanmichel@sequans.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'handler': 0.04; 'mrab': 0.04; 'python:': 0.05; 'raised': 0.07; 'herman': 0.09; 'propagated': 0.09; 'subject:logging': 0.16; 'wrote:': 0.18; 'section.': 0.18; 'header:In-Reply-To:1': 0.22; 'tried': 0.27; 'weird': 0.29; 'handling': 0.30; 'config': 0.30; 'identifies': 0.30; 'go.': 0.32; 'header:User-Agent:1': 0.33; 'file': 0.34; 'root': 0.34; 'to:addr:python-list': 0.35; 'skip:" 20': 0.35; 'subject:with': 0.37; 'being': 0.40; 'to:addr:python.org': 0.40; 'stop': 0.61; 'here': 0.64; 'alternative': 0.65; 'abc': 0.91
X-IronPort-AV E=Sophos;i="4.73,450,1325458800"; d="scan'208";a="173395"
X-Virus-Scanned amavisd-new at zimbra.sequans.com
Date Mon, 20 Feb 2012 12:48:22 +0100
From Jean-Michel Pichavant <jeanmichel@sequans.com>
User-Agent Mozilla-Thunderbird 2.0.0.24 (X11/20100328)
MIME-Version 1.0
To python-list@python.org
Subject Re: logging with logging.config.fileConfig
References <CANOe_miBMP1S8kPEX8Q8=p6dH6Jrj2mLU7Q32t6o_aGwWiY3tg@mail.gmail.com> <4F41647E.2020400@mrabarnett.plus.com>
In-Reply-To <4F41647E.2020400@mrabarnett.plus.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
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.8.1329738512.3037.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1329738512 news.xs4all.nl 6913 [2001:888:2000:d::a6]:56799
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:20620

Show key headers only | View raw


MRAB wrote:
> On 19/02/2012 20:23, Herman wrote:
>> I tried to use file to config my logger and I got a weird situation
>> that each message is outputted twice...
>> Here is my scenario:
>> python: 2.6
>>
>> file abc_logging.conf:
>>
> [snip]
>> [logger_abc]
>> level=DEBUG
>> handlers=consoleHandler
>> qualname=abc
>
> Add this line to stop the logging message from being propagated to
> higher level (ancestor) loggers:
>
> propagate=0
>
> [snip]
>>

An alternative solution is to add a handler to the root logger only. If 
you don't plan to have specific handling for the abc logger, this is the 
way to go.
Remove "handlers=consoleHandler" from abc section.

Note that %name will still properly identifies the logger that raised 
the event.

JM

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


Thread

Re: logging with logging.config.fileConfig Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-02-20 12:48 +0100

csiph-web