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


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

Re: logging issues

Started byAndrea Crotti <andrea.crotti.0@gmail.com>
First post2011-12-13 16:21 +0000
Last post2011-12-13 16:21 +0000
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 issues Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-12-13 16:21 +0000

#17146 — Re: logging issues

FromAndrea Crotti <andrea.crotti.0@gmail.com>
Date2011-12-13 16:21 +0000
SubjectRe: logging issues
Message-ID<mailman.3603.1323793282.27778.python-list@python.org>
On 12/13/2011 04:11 PM, Jean-Michel Pichavant wrote:
> Not really, if you use the classic way, your subloggers should be 
> created an never configured. Their default behavior is to raise any 
> log event to its parent. That way, all event logs end up being handled 
> by the root logger.
>

Ok thanks now it's more clear.your codebase which is ???
>
> [snip some working code]
>
> As a general advices
> - try to never configure a child logger, you should only need to 
> create one whithout setting its level nor its handler. A logger is 
> responsible of raising log events, not handling them. The root logger 
> is supposed to handle them.
> - Configure only the root logger and do it in the main function, and 
> only there. Configuring means calling basicConfig, setting the level, 
> adding a handler etc... everything except the creation.
>
> JM

It turned out that I was calling
logger = logging.getLogger()

In other modules too, and then apparently the logging level was
modified automatically to the default one, is that possible?

changing with
logger = logging.getLogger(__name__) everywhere solved my problems..

[toc] | [standalone]


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


csiph-web