Skip to content

Commit

Permalink
Add max files in rotation (#2502)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chida82 authored Apr 24, 2021
1 parent 560074d commit 79ecc40
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion chia/util/chia_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions chia/util/initial-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 79ecc40

Please sign in to comment.