file_handler.setLevel(logging.DEBUG)
formatter = logging.Formatter(
    '%(asctime)s %(filename)s, %(lineno)d, %(funcName)s: %(message)s')
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)
Restart logging to a new file (Python)