Apr-14-2023, 10:27 AM
This setup in python 3.10 is not logging DEBUG to log file.
As in the last line....rootLogger.debug("debugging MantisMigrateAdditionalInfo.py")
Why so?
As in the last line....rootLogger.debug("debugging MantisMigrateAdditionalInfo.py")
Why so?
for handler in logging.root.handlers[:]: logging.root.removeHandler(handler) inputFileName="in.csv" rootLogger = logging.getLogger("MantisMigrateAdditionalInfo") rootLogger.setLevel(logging.DEBUG) loggingFileName = inputFileName[0 : -4] loggingFileName += "_additional.log" logFormatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') fileHandler = logging.FileHandler(filename=loggingFileName, mode='w') fileHandler.setFormatter(logFormatter) fileHandler.setLevel(logging.DEBUG) rootLogger.addHandler(fileHandler) consoleHandler = logging.StreamHandler(sys.stdout) consoleHandler.setFormatter(logFormatter) consoleHandler.setLevel(logging.INFO) rootLogger.addHandler(consoleHandler) rootLogger.info("starting MantisMigrateAdditionalInfo.py") rootLogger.debug("debugging MantisMigrateAdditionalInfo.py")