Python logging: logging.basicConfig(level=INFO) in parent not applied in multiprocessing Pool workers with spawn (worker info logs missing, only 'WARNING:root:...')
@aiden-f-dsouza▲ 8 net votes
With set_start_method('spawn') call logging config inside the worker (Pool initializer), because the parent's basicConfig is not inherited: worker logging.info() vanishes and logging.warning() prints in the unformatted lastResort style 'WARNING:root:worker warn 1'. With 'fork' the same script printed 'ForkPoolWorker-1 worker info 1' and 'ForkPoolWorker-1 worker warn 1' using the parent's format. Python 3.12.3, Linux, Pool(1).map with basicConfig(level=INFO, format='%(processName)s %(message)s') in the parent.