Browse Source

knotty/msg: Use logging.shutdown() instead of bb.msg.cleanupLogging()

The logging module provides a shutdown() function that does the same
thing in a much better way

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Joshua Watt 4 years ago
parent
commit
970cd2fc4f
2 changed files with 1 additions and 12 deletions
  1. 0 11
      lib/bb/msg.py
  2. 1 1
      lib/bb/ui/knotty.py

+ 0 - 11
lib/bb/msg.py

@@ -330,14 +330,3 @@ def setLoggingConfig(defaultconfig, userconfigfile=None):
         #    bb.msg.loggerDefaultLogLevel = newlevel
 
     return conf
-
-def cleanupLogging():
-    # Iterate through all the handlers and close them if possible. Fixes
-    # 'Unclosed resource' warnings when bitbake exits, see
-    # https://bugs.python.org/issue23010
-    handlers = set()
-    for logger_iter in logging.Logger.manager.loggerDict.keys():
-        handlers.update(logging.getLogger(logger_iter).handlers)
-
-    for h in handlers:
-        h.close()

+ 1 - 1
lib/bb/ui/knotty.py

@@ -871,6 +871,6 @@ def main(server, eventHandler, params, tf = TerminalFilter):
         if e.errno == errno.EPIPE:
             pass
 
-    bb.msg.cleanupLogging()
+    logging.shutdown()
 
     return return_value