Problem with logging module

Steve Erickson steve_erickson at hotmail.com
Thu Oct 14 08:01:48 EDT 2004


"Diez B. Roggisch" <deetsNOSPAM at web.de> wrote in message news:<ckjpbd$o0b$02$1 at news.t-online.com>...
> > self.logger = logging.getLogger(name)
> > self.logger.propagate = False
> > handler = logging.FileHandler(dir + '/' + name + '.log')
> > self.logger.addHandler(handler)
> ^^^^
> Thats your problem - only set the handler once for the runtime of your
> program.
Thanks.  Coming from C++, I thought that the local logger instance in
each test method would go away when I went out of the context of the
method.  Sounds like the logging class in Python maintains artifacts
that affect instantiations in other methods.  Or maybe I'm confused
about how Python handles local versus class variables.



More information about the Python-list mailing list