[IPython-User] duplicated logging messages
David Warde-Farley
wardefar@iro.umontreal...
Mon Jan 23 07:40:44 CST 2012
On 2012-01-20, at 1:30 PM, Ruby Stevenson wrote:
> hi, Thomas
>
> upon further look, it seems the dup messages only shows up and I
> issues multiple %run command ... as the cycle of run, modify, run goes
> ...
>
> Is there anyway I can start from a clean slate short of restart
> ipython all together?
Once your script acquires the logger object, you need to remove all the excess handlers from logger.handlers. logging.getLogger is handing you back the same object each time, and you are probably adding handlers to it -- either check to see if handlers already exist in the logging.handlers list, or do something like while len(logger.handlers()) > 0: logger.pop() before doing your custom setup.
David
More information about the IPython-User
mailing list