problems with logging module

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Jul 30 01:01:19 EDT 2007


En Sun, 29 Jul 2007 18:29:58 -0300, Alia Khouri <alia_khouri at yahoo.com>  
escribió:

> I've been struggling with the logging module in the stdlib which seems
> to me rather counter-intuitive:
>
> For some reason it refuses to recognize configuration options when
> they are set inside a class so I have had to initialize logging and
> set the configuration options in the global scope of my module with
> logging.basicConfig.

That looks very strange.

> Here's what I did within the class setup method:

Do you mean in its __init__ method? Are you sure an instance of that class  
is actually created?

> self.log = logging.getLogger()
>
> # format
> log_format= self.local.format

If you are saying that, later, using self.local.format is different that  
using log_format, that's hard to believe (unless self/local/format are  
insane objects...)

> self.log gets initialized but the formatting options do not get
> recognized... this is a pain...

To see what's going on, try using this old-fashioned debug technique: a  
few print statements.

-- 
Gabriel Genellina




More information about the Python-list mailing list