def _check_logger_class():
 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 _check_logger_class ( ) : 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 ( )
make sure process name is recorded when loggers are used .