Skip to content

Commit

Permalink
cloudinit.log: Don't configure NullHandler (#4435)
Browse files Browse the repository at this point in the history
NullHandler hasn't been required to prevent the logging warnings since
commit 5a27d4018 landed in Python, which was released in Python 3.2.
  • Loading branch information
holmanb committed Sep 20, 2023
1 parent f8269c6 commit 8a56a29
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions cloudinit/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,14 @@ def setupLogging(cfg=None):


def resetLogging():
"""Remove all current handlers, unset log level and add a NullHandler.
(Adding the NullHandler avoids "No handlers could be found for logger XXX"
messages.)
"""
"""Remove all current handlers and unset log level."""
log = logging.getLogger()
handlers = list(log.handlers)
for h in handlers:
h.flush()
h.close()
log.removeHandler(h)
log.setLevel(logging.NOTSET)
log.addHandler(logging.NullHandler())


def setup_backup_logging():
Expand Down

0 comments on commit 8a56a29

Please sign in to comment.