X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=logging_utils.py;h=ddea102d4b7d4a94ea98d87a5877d922431d8225;hb=2c43e31aae1138f79c30619cde25746e41390152;hp=de69046c30a82914b04e288982fcf93455fcb965;hpb=48a2eb5656508e2d1d16e6f22e979bed5ee682a6;p=python_utils.git diff --git a/logging_utils.py b/logging_utils.py index de69046..ddea102 100644 --- a/logging_utils.py +++ b/logging_utils.py @@ -146,7 +146,7 @@ cfg.add_argument( cfg.add_argument( '--logging_clear_preexisting_handlers', action=argparse_utils.ActionNoYes, - default=False, + default=True, help=( 'Should logging code clear preexisting global logging handlers and thus insist that is ' + 'alone can add handlers. Use this to work around annoying modules that insert global ' + @@ -523,9 +523,8 @@ def initialize_logging(logger=None) -> logging.Logger: f'Initialized global logging; default logging level is {level_name}.' ) if config.config['logging_clear_preexisting_handlers'] and preexisting_handlers_count > 0: - logger.warning( - 'Logging cleared {preexisting_handlers_count} global handlers (--logging_clear_preexisting_handlers)' - ) + msg = f'Logging cleared {preexisting_handlers_count} global handlers (--logging_clear_preexisting_handlers)' + logger.warning(msg) logger.debug(f'Logging format specification is "{fmt}"') if config.config['logging_debug_threads']: logger.debug('...Logging format spec captures tid/pid (--logging_debug_threads)')