(continued from previous page) 

} }, 'handlers': { 'console': { 'class':'logging.StreamHandler ', 'formatter':'simple', 'level ':'INFO ' }, 'file': { 'class':'logging.FileHandler ', 'filename':'mplog.log ', 'mode':'w', 'formatter':'detailed' }, 'foofile': { 'class':'logging.FileHandler ', 'filename':'mplog-foo.log ', 'mode':'w', 'formatter':'detailed' }, 'errors': { 'class':'logging.FileHandler ', 'filename':'mplog-errors.log ', 'mode':'w', 'formatter':'detailed', 'level ':'ERROR' } }, 'loggers': { 'foo': { 'handlers': ['foofile'] } }, 'root': { 'handlers': ['console','file','errors'], 'level ':'DEBUG' } } # Log some initial events, just to show that logging in the parent works # normally. logging.config.dictConfig(config_initial) logger=logging.getLogger('setup') logger.info('About to create workers ... ') workers =[] for i in range(5): wp =Process(target =worker_process, name ='worker %d '%(i +1), args=(config_worker,)) workers.append(wp) wp.start() logger.info('Started worker: %s ', wp.name) logger.info('About to create listener ... ') stop_event=Event() lp=Process(target =listener_process, name ='listener', args=(q, stop_event, config_listener)) lp.start() logger.info('Started listener') # We now hang around for the workers to finish their work. for wp in workers: wp.join() # Workers all done, listening can now stop. # Logging in the parent still works normally. 

(continues on next page) 

