All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Watt <jpewhacker@gmail.com>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCH 3/3] bitbake: Use logging.shutdown() instead of bb.msg.cleanupLogging()
Date: Thu, 12 Mar 2020 13:30:04 -0500	[thread overview]
Message-ID: <20200312183004.8339-4-JPEWhacker@gmail.com> (raw)
In-Reply-To: <20200312183004.8339-1-JPEWhacker@gmail.com>

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>
---
 bitbake/lib/bb/msg.py       | 11 -----------
 bitbake/lib/bb/ui/knotty.py |  2 +-
 2 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py
index 3f95e21cc1..29f0a3999e 100644
--- a/bitbake/lib/bb/msg.py
+++ b/bitbake/lib/bb/msg.py
@@ -294,14 +294,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()
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index db4511844a..33ee891256 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/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
-- 
2.17.1



      parent reply	other threads:[~2020-03-12 18:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-12 18:30 [PATCH 0/3] More logging improvements Joshua Watt
2020-03-12 18:30 ` [PATCH 1/3] bitbake: msg: Return config object Joshua Watt
2020-03-12 18:30 ` [PATCH 2/3] bitbake: knotty: Treat verbconsole as a console output Joshua Watt
2020-03-12 18:30 ` Joshua Watt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200312183004.8339-4-JPEWhacker@gmail.com \
    --to=jpewhacker@gmail.com \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.