def main():

    def configure_logging():
        logging_config = {'formatters': {'f': {'format':
            '%(processName)-10s %(name)s %(levelname)-8s %(message)s'}},
            'handlers': {'h': {'level': 'INFO', 'class':
            'logging.StreamHandler', 'formatter': 'f'}}, 'loggers': {'': {
            'handlers': ['h'], 'level': 'INFO', 'propagate': True}},
            'version': 1}
pname = mp.current_process().name
if pname != 'MainProcess':
    logging_config['handlers'] = {'h': {'level': 'INFO', 'formatter': 'f',
        'class': 'logging.FileHandler', 'filename': pname + '.log'}}
logging.config.dictConfig(logging_config)
configure_logging()

def pool_initializer():
    configure_logging()
n_cores = 4
pool = mp.Pool(n_cores, initializer=pool_initializer)
pool.map(do_log, list(range(100)))
pool.close()
pool.join()
How can I prevent the inheritance of python loggers and handlers during multiprocessing based on fork?