diff options
Diffstat (limited to 'buildscripts/resmokelib/logging/handlers.py')
-rw-r--r-- | buildscripts/resmokelib/logging/handlers.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/buildscripts/resmokelib/logging/handlers.py b/buildscripts/resmokelib/logging/handlers.py index d67bf13f724..cff5793392c 100644 --- a/buildscripts/resmokelib/logging/handlers.py +++ b/buildscripts/resmokelib/logging/handlers.py @@ -60,6 +60,7 @@ class BufferedHandler(logging.Handler): self.__emit_buffer = [] self.__flush_event = None # A handle to the event that calls self.flush(). self.__flush_scheduled_by_emit = False + self.__close_called = False self.__flush_lock = threading.Lock() # Serializes callers of self.flush(). @@ -121,7 +122,7 @@ class BufferedHandler(logging.Handler): self.__flush(close_called=False) with self.__emit_lock: - if self.__flush_event is not None: + if self.__flush_event is not None and not self.__close_called: # We cancel 'self.__flush_event' in case flush() was called by someone other than # the flush thread to avoid having multiple flush() events scheduled. flush.cancel(self.__flush_event) @@ -151,6 +152,8 @@ class BufferedHandler(logging.Handler): """Flush the buffer and tidies up any resources used by this handler.""" with self.__emit_lock: + self.__close_called = True + if self.__flush_event is not None: flush.cancel(self.__flush_event) |