Script below is using python threads:
import logging
import threading
import time
def thread_function(name):
    logging.info("Thread %s: starting", name)
    time.sleep(2)
    logging.info("Thread %s: finishing", name)
if ____name____ == "____main____":
    format = "%(asctime)s: %(message)s"
    logging.basicConfig(format=format, level=logging.INFO,
                        datefmt="%H:%M:%S")
    logging.info("Main    : before creating thread")
    x = threading.Thread(target=thread_function, args=(1,))
    logging.info("Main    : before running thread")
    x.start()
    logging.info("Main    : wait for the thread to finish")
    # x.join()
    logging.info("Main    : all done")
Output of the script above is:
10:04:50: Main    : before creating thread
10:04:50: Main    : before running thread
10:04:50: Thread 1: starting
10:04:50: Main    : wait for the thread to finish
10:04:50: Main    : all done
10:04:52: Thread 1: finishing
While when I use multiprocessor thing:
from multiprocessing import Process
import time
import logging
def thread_function(name):
    logging.info("Thread %s: starting", name)
    time.sleep(2)
    logging.info("Thread %s: finishing", name)
if ____name____ == "____main____":
    format = "%(asctime)s: %(message)s"
    logging.basicConfig(format=format, level=logging.INFO,
                        datefmt="%H:%M:%S")
    logging.info("Main    : before creating thread")
    p1 = Process(target=thread_function, args=(1,))
    logging.info("Main    : before running thread")
    p1.start()
    logging.info("Main    : wait for the thread to finish")
    p1.join()
    logging.info("Main    : all done"
It's not capturing the output of the function that the process is calling as you can see in the output below:
10:08:58: Main    : before creating thread
10:08:58: Main    : before running thread
10:08:58: Main    : wait for the thread to finish
10:09:00: Main    : all done
Can anyone tell what I have missing here?
 
     
     
    