'How to set up two loggers one too append and the other to overwrite?

I am trying to set up two loggers that log info in an while loop. I want the first logger 'event_logger' to append information, whilst the second logger 'status_logger' needs to overwrite the file each time with the current status. This is how I have set them both up, but both logs are appending information and the 'status_logger' fails to overwrite each time. What am I doing wrong here?

## event log
event_logger = logging.getLogger('event_log')
event_logger.setLevel(logging.DEBUG)
event_logger_handler = logging.FileHandler(f'{datetime.now().date()}_event_log.log', mode='a')
event_logger_handler.setFormatter(formatter)
event_logger.addHandler(event_logger_handler)

## status log
status_logger = logging.getLogger('status_log')
status_logger.setLevel(logging.DEBUG)
status_logger_handler = logging.FileHandler(f'{datetime.now().date()}_status_log.log', mode='w+')
status_logger_handler.setFormatter(formatter)
status_logger.addHandler(status_logger_handler)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source