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


Groups > comp.lang.python > #20620 > unrolled thread

Re: logging with logging.config.fileConfig

Started byJean-Michel Pichavant <jeanmichel@sequans.com>
First post2012-02-20 12:48 +0100
Last post2012-02-20 12:48 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#20620 — Re: logging with logging.config.fileConfig

FromJean-Michel Pichavant <jeanmichel@sequans.com>
Date2012-02-20 12:48 +0100
SubjectRe: logging with logging.config.fileConfig
Message-ID<mailman.8.1329738512.3037.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web