Server IP : 128.199.20.84 / Your IP : 172.69.17.96 Web Server : Apache/2.4.41 (Ubuntu) System : Linux competent-maruti 5.4.0-128-generic #144-Ubuntu SMP Tue Sep 20 11:00:04 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.0.20 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF Directory (0755) : /usr/lib/linux/../python3/dist-packages/cloudinit/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
# Copyright (C) 2012 Canonical Ltd. # Copyright (C) 2012 Yahoo! Inc. # # Author: Scott Moser <[email protected]> # Author: Joshua Harlow <[email protected]> # # This file is part of cloud-init. See LICENSE file for license information. import logging import sys # Default fallback format FALL_FORMAT = ( "FALLBACK: %(asctime)s - %(filename)s[%(levelname)s]: " + "%(message)s" ) class QuietStreamHandler(logging.StreamHandler): def handleError(self, record): pass def patch_logging(): # Replace 'handleError' with one that will be more # tolerant of errors in that it can avoid # re-notifying on exceptions and when errors # do occur, it can at least try to write to # sys.stderr using a fallback logger fallback_handler = QuietStreamHandler(sys.stderr) fallback_handler.setFormatter(logging.Formatter(FALL_FORMAT)) def handleError(self, record): try: fallback_handler.handle(record) fallback_handler.flush() except IOError: pass setattr(logging.Handler, "handleError", handleError) # vi: ts=4 expandtab