-
-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Description
Greetings,
When investigating the following bug:
noxdafox/pebble#113
It turned out the multiprocess library seems to not propagate the process name to the logging library correctly.
import logging
import multiprocess
import multiprocessing
logging.basicConfig(format='%(processName)s-%(process)d - %(levelname)s:%(message)s', level=logging.DEBUG)
def standardlib():
logger.error("Using multiprocessing")
logger.error(multiprocessing.current_process().name)
def externallib():
logger.error("Using multiprocess")
logger.error(multiprocess.current_process().name)
if __name__ == "__main__":
logger = logging.getLogger("main")
p = multiprocessing.Process(target=standardlib, name="multiprocessing")
p.start()
p.join()
p = multiprocess.Process(target=externallib, name="multiprocess")
p.start()
p.join()Output:
multiprocessing-7814 - ERROR:Using multiprocessing
multiprocessing-7814 - ERROR:multiprocessing
MainProcess-7815 - ERROR:Using multiprocess
MainProcess-7815 - ERROR:multiprocess
The expected output would be:
multiprocessing-7814 - ERROR:Using multiprocessing
multiprocessing-7814 - ERROR:multiprocessing
multiprocess-7815 - ERROR:Using multiprocess
multiprocess-7815 - ERROR:multiprocess
$ python --version
Python 3.9.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels