Simply shutdown logging instead of cleaning up
@@ -137,8 +137,6 @@ class Command(object):
)
sys.exit(VIRTUALENV_NOT_FOUND)
- original_root_handlers = set(logging.root.handlers)
-
try:
status = self.run(options, args)
# FIXME: all commands should return an exit status
@@ -178,10 +176,9 @@ class Command(object):
retries=0,
timeout=min(5, options.timeout)) as session:
pip_version_check(session, options)
- # Avoid leaking loggers
- for handler in set(logging.root.handlers) - original_root_handlers:
- # this method benefit from the Logger class internal lock
- logging.root.removeHandler(handler)
+
+ # Shutdown the logging module
+ logging.shutdown()
return SUCCESS
