Index: Lib/multiprocessing/util.py =================================================================== --- Lib/multiprocessing/util.py (revision 68727) +++ Lib/multiprocessing/util.py (working copy) @@ -69,34 +69,10 @@ atexit._exithandlers.remove((_exit_function, (), {})) atexit._exithandlers.append((_exit_function, (), {})) - _check_logger_class() _logger = logging.getLogger(LOGGER_NAME) return _logger -def _check_logger_class(): - ''' - Make sure process name is recorded when loggers are used - ''' - # XXX This function is unnecessary once logging is patched - import logging - if hasattr(logging, 'multiprocessing'): - return - - logging._acquireLock() - try: - OldLoggerClass = logging.getLoggerClass() - if not getattr(OldLoggerClass, '_process_aware', False): - class ProcessAwareLogger(OldLoggerClass): - _process_aware = True - def makeRecord(self, *args, **kwds): - record = OldLoggerClass.makeRecord(self, *args, **kwds) - record.processName = current_process()._name - return record - logging.setLoggerClass(ProcessAwareLogger) - finally: - logging._releaseLock() - def log_to_stderr(level=None): ''' Turn on logging and add a handler which prints to stderr Index: Lib/logging/__init__.py =================================================================== --- Lib/logging/__init__.py (revision 68727) +++ Lib/logging/__init__.py (working copy) @@ -100,6 +100,11 @@ logThreads = 1 # +# If you don't want multiprocessing information in the log, set this to zero +# +logMultiprocessing = 1 + +# # If you don't want process information in the log, set this to zero # logProcesses = 1 @@ -266,6 +271,11 @@ else: self.thread = None self.threadName = None + if logMultiprocessing: + from multiprocessing import current_process + self.processName = current_process().name + else: + self.processName = None if logProcesses and hasattr(os, 'getpid'): self.process = os.getpid() else: