From 0acb711b446a399a533f2d42a5cab5975a33569f Mon Sep 17 00:00:00 2001 From: Tal Berlowitz Date: Wed, 25 Oct 2023 10:56:34 +0300 Subject: [PATCH] Remove calls to logging.addLevelName() for existing log levels Calling logging.addLevelName() for existing log levels overrides the original values in Python's logging module, which then makes it incompatible with log levels assumed by SysLogHandler. This causes unexpected behavior when using SysLogHandler, basically making it print all messages to syslog with loglevel warning. --- ifupdown2/lib/log.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ifupdown2/lib/log.py b/ifupdown2/lib/log.py index 6a6f3e61..f72e0614 100644 --- a/ifupdown2/lib/log.py +++ b/ifupdown2/lib/log.py @@ -114,12 +114,6 @@ def __init__(self): sys.stderr.write("warning: syslog: %s\n" % str(e)) self.__syslog_handler = None - logging.addLevelName(logging.CRITICAL, "critical") - logging.addLevelName(logging.WARNING, "warning") - logging.addLevelName(logging.ERROR, "error") - logging.addLevelName(logging.DEBUG, "debug") - logging.addLevelName(logging.INFO, "info") - try: self.__init_debug_logging() except Exception as e: