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: 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 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: <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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 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