bitbake: 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

(Bitbake rev: 970cd2fc4f0bbc93069dee5a15a608dd76081c67)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joshua Watt
2020-03-12 13:30:04 -05:00
committed by Richard Purdie
parent 5ce50b3ce7
commit bf7d68c812
2 changed files with 1 additions and 12 deletions

View File

@@ -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()

View File

@@ -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