Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are a few ways to obtain log output from a multiprocessing.Process:

  1. Use the logging module and configure it to write to a file or stream. This can be done in the parent process before starting the child process. The child process can then use the logging module to write to the same file or stream.

  2. Use a Queue to pass log messages from the child process to the parent process. The child process can use the logging module to write messages to the Queue, while the parent process reads messages from the Queue and writes them to a file or stream.

  3. Override the run() method of the child process to write log messages directly to a file or stream. This requires more manual work and may not be as flexible as using the logging module or a Queue.