summaryrefslogtreecommitdiffstats
path: root/Lib/logging/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/logging/__init__.py')
-rw-r--r--Lib/logging/__init__.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index b6941b4..3fe03cd 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -273,12 +273,10 @@ class LogRecord:
self.threadName = None
if not logMultiprocessing:
self.processName = None
+ elif 'multiprocessing' not in sys.modules:
+ self.processName = 'MainProcess'
else:
- try:
- from multiprocessing import current_process
- self.processName = current_process().name
- except ImportError:
- self.processName = None
+ self.processName = sys.modules['multiprocessing'].current_process().name
if logProcesses and hasattr(os, 'getpid'):
self.process = os.getpid()
else: