Mar-21-2022, 03:49 PM
You can add a handler of type RotatingFileHandler. Check the documentation and make sure you don't set either maxBytes or backupCount to 0. You could modify your earlier logging setup like so:
import logging from logging.handlers import RotatingFileHandler logging.basicConfig( level=logging.INFO, format='%(asctime)s %(message)s'), handlers=[RotatingFileHandler('/home/pi/logs/App1_log.log', maxBytes=1000000, backupCount=4), )