util:wsgi: Don't clobber `handler` when clearing StreamHandlers
authorW. Trevor King <wking@tremily.us>
Thu, 31 Jan 2013 23:39:48 +0000 (18:39 -0500)
committerW. Trevor King <wking@tremily.us>
Thu, 31 Jan 2013 23:39:48 +0000 (18:39 -0500)
This bug was introduced in:

  commit 400c9251eedbd1caa3b28135b4bc5d2bf2124ac5
  Author: W. Trevor King <wking@tremily.us>
  Date:   Thu Jan 24 02:43:53 2013 -0500

    util:wsgi: If we're logging to a file, shift libbe.LOG too

where the removed handlers clobbered our initial
TimedRotatingFileHandler.

libbe/util/wsgi.py

index b731ec80fe1f58c857fdeb654e844c3fbd4bed63..dcddcf331601bdc5e8a3a525aa9302976d53cdbf 100644 (file)
@@ -688,8 +688,8 @@ class ServerCommand (libbe.command.base.Command):
                 path, when='w6', interval=1, backupCount=4,
                 encoding=libbe.util.encoding.get_text_file_encoding())
             while libbe.LOG.handlers:
-                handler = libbe.LOG.handlers[0]
-                libbe.LOG.removeHandler(handler)
+                h = libbe.LOG.handlers[0]
+                libbe.LOG.removeHandler(h)
             libbe.LOG.addHandler(handler)
         else:
             handler = logging.StreamHandler(self.stdout)