Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions bbot/core/config/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import sys
import atexit
import logging
import threading
from copy import copy
import multiprocessing
import logging.handlers
Expand Down Expand Up @@ -79,6 +78,11 @@ def __init__(self, core):
self.log_level = logging.INFO

def cleanup_logging(self):
# Stop queue listener first (drains queue and stops monitor thread)
if self.listener is not None:
with suppress(Exception):
self.listener.stop()

# Close the queue handler
with suppress(Exception):
self.queue_handler.close()
Expand All @@ -92,13 +96,6 @@ def cleanup_logging(self):
with suppress(Exception):
handler.close()

# Stop queue listener
with suppress(Exception):
stop_thread = threading.Thread(target=self.listener.stop)
stop_thread.daemon = True
stop_thread.start()
stop_thread.join()

def setup_queue_handler(self, logging_queue=None, log_level=logging.DEBUG):
if logging_queue is None:
logging_queue = self.queue
Expand Down
Loading