Modern Python logging
Why Stack Overflow recommends it
Stack Overflow users link it when answering Python logging questions, especially multiprocessing and QueueHandler setups, as a current and thorough tutorial on the logging module.
Recommended by 2 people across 2 different months, 2024 to 2024.
What it is
A 21-minute tutorial by James Murphy of mCoding on Python's built-in logging package. It covers the modern way to use logging, avoiding outdated patterns that older tutorials still teach, and the parts of the 2002-era API that do not follow current conventions.
What people said
Recommends Luckasino · 2024-03 · Stack Overflow · on “Python - proper logging import to classes”
I found this interesting and really beneficial video explaining a lot about logging. So switch my style according to that. link: [this video]
Recommends Aaron · 2024-07 · Stack Overflow · on “Python: Logging to a single file when having a ProcessPoolExecutor within Process workers, using QueueHandler”
I took the opportunity to simplify your example, but here's what I think you're going for? (please read the code comments for more information) I see some unrelated things as possibly causing issues in the future (nested process creation is very hard to ensure proper cleanup in a fault scenario), and I would definitely recommend the tutorial on modern logging by mCoding on YT [this video] . It has lots of great information. import logging import logging.handlers import multiprocessing import threading from concurrent.futures import ProcessPoolExecutor LOG_SIZE = 2**16 # 64 KiB BACKUP_COUNT = 10 LOG_FORMAT = '%(asctime)s %(processName)-10s %(name)s %(levelname)-8s %(message)s' LOG_NAME = 'mptest.l
Cites Yolkions · 2024-09 · Stack Overflow · on “How to share a configured logger between running processes?”
Sharing a logger object between processes can get weird fast. I would recommend using the QueueHandler class as you have started to do this and then use a toplevel logging. Then set all the configuration settings on the main Queue logger. This works in python 3.11.9 For example import multiprocessing import logging import logging.config from logging.handlers import QueueListener from logging import StreamHandler import atexit STD_FORMAT_STR = r"[%(levelname)s @ %(name)s|%(filename)s|L%(lineno)d|%(asctime)s|%(process)d]: %(message)s" STD_DATE_FORMAT_STR = "%Y-%m-%dT%H:%M:%S%z" def create_share_logging_queue(): ### CREATE THE SHARED LOGGING QUEUE loggingQueue = multiprocessing.Queue() ## CREAT