When using the python logging module, how do I specify the file name of the automatically generated log when installing the size cut?

topic description

when using the python logging module, how do I specify the file name of the automatically generated log when installing the size cut?

< hr >
logger = logging.getLogger("mylogger")
logger.setLevel(level=logger_level)
fmt = "%(asctime)s - %(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s"
format_str = logging.Formatter(fmt)
fh = logging.FileHandler(fn, encoding="utf-8")
fh = logging.handlers.RotatingFileHandler(fn,maxBytes=10000,backupCount=10)
fh.setFormatter(fmt=format_str)
logger.addHandler(fh)

when using RotatingFileHandler , how can I customize the filename of the "log.1"-like file that it automatically generates?

Aug.24,2021

RotatingFileHandler inherits from the BaseRotatingHandler class, and has the following method

   
pre-and post-modified file names, mylog and backup

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea8f6a-1f1a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea8f6a-1f1a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?