let's say I wanted to have several handlers, but I did not want the logging.ERROR
level messages to show up in any file except logs/error.log
formatter = logging.Formatter('%(asctime)s %(levelname)s: %(message)s', datefmt='%m/%d %H:%M:%S')
handler = RotatingFileHandler('logs/debug.log', maxBytes=100000, backupCount=1)
handler.setLevel(logging.DEBUG)
handler.setFormatter(formatter)
error_handler = RotatingFileHandler('logs/error.log', maxBytes=100000, backupCount=1)
error_handler.setFormatter(formatter)
error_handler.setLevel(logging.ERROR)
app.logger.addHandler(handler)
app.logger.addHandler(error_handler)
so let's say I wanted handler to handle everything from logging.DEBUG
up to and including logging.WARNING
, but NOT including logging.ERROR
. Is this possible?