diff --git a/chia/util/chia_logging.py b/chia/util/chia_logging.py index 09f484da73c9..3c894deac3be 100644 --- a/chia/util/chia_logging.py +++ b/chia/util/chia_logging.py @@ -29,7 +29,8 @@ def initialize_logging(service_name: str, logging_config: Dict, root_path: Path) logger.addHandler(handler) else: logger = logging.getLogger() - handler = ConcurrentRotatingFileHandler(log_path, "a", maxBytes=20 * 1024 * 1024, backupCount=7) + maxrotation = logging_config.get("log_maxfilesrotation", 7) + handler = ConcurrentRotatingFileHandler(log_path, "a", maxBytes=20 * 1024 * 1024, backupCount=maxrotation) handler.setFormatter( logging.Formatter( fmt=f"%(asctime)s.%(msecs)03d {service_name} %(name)-{file_name_length}s: %(levelname)-8s %(message)s", diff --git a/chia/util/initial-config.yaml b/chia/util/initial-config.yaml index 3513da8caffc..7bdb436d96b0 100644 --- a/chia/util/initial-config.yaml +++ b/chia/util/initial-config.yaml @@ -99,6 +99,7 @@ logging: &logging log_stdout: False # If True, outputs to stdout instead of a file log_filename: "log/debug.log" log_level: "WARNING" # Can be CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET + log_maxfilesrotation: 7 # Max files in rotation. Default value 7 if the key is not set harvester: # The harvester server (if run) will run on this port