diff --git a/docs/CONFIG.md b/docs/CONFIG.md index b578e52b..90ff43f1 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -38,12 +38,14 @@ leave recipient blank, if you don't need this. ```YAML logging: log_to_file: True + backup_count: 7 log_path: "/var/log/ffplayout/" log_level: "DEBUG" ffmpeg_level: "ERROR" ``` Logging to file, if `log_to_file = False` > log to console. +`backup_count` says how long log files will be saved in days. Path to **/var/log/** only if you run this program as *deamon*. `log_level` can be: **DEBUG, INFO, WARNING, ERROR** `ffmpeg_level` can be: **INFO, WARNING, ERROR** diff --git a/ffplayout.yml b/ffplayout.yml index 3af06ea5..c905cdd1 100644 --- a/ffplayout.yml +++ b/ffplayout.yml @@ -21,10 +21,12 @@ mail: mail_level: "ERROR" logging: - helptext: Logging to file, if 'log_to_file' False log to console. Path to /var/log/ - only if you run this program as deamon. 'log_level' can be DEBUG, INFO, WARNING, + helptext: Logging to file, if 'log_to_file' False log to console. 'backup_count' + says how long log files will be saved in days. Path to /var/log/ only if you + run this program as deamon. 'log_level' can be DEBUG, INFO, WARNING, ERROR. 'ffmpeg_level' can be INFO, WARNING, ERROR. log_to_file: True + backup_count: 7 log_path: "/var/log/ffplayout/" log_level: "DEBUG" ffmpeg_level: "ERROR" diff --git a/ffplayout/utils.py b/ffplayout/utils.py index 484db7bc..ccef64f5 100644 --- a/ffplayout/utils.py +++ b/ffplayout/utils.py @@ -203,6 +203,7 @@ def load_config(): if _init.load: _log.to_file = cfg['logging']['log_to_file'] + _log.backup_count = cfg['logging']['backup_count'] _log.path = cfg['logging']['log_path'] _log.level = cfg['logging']['log_level'] _log.ff_level = cfg['logging']['ffmpeg_level'] @@ -306,11 +307,11 @@ if _log.to_file and _log.path != 'none': p_format = logging.Formatter('[%(asctime)s] [%(levelname)s] %(message)s') f_format = logging.Formatter('[%(asctime)s] %(message)s') p_file_handler = TimedRotatingFileHandler(playout_log, when='midnight', - backupCount=5) + backupCount=_log.backup_count) d_file_handler = TimedRotatingFileHandler(decoder_log, when='midnight', - backupCount=5) + backupCount=_log.backup_count) e_file_handler = TimedRotatingFileHandler(encoder_log, when='midnight', - backupCount=5) + backupCount=_log.backup_count) p_file_handler.setFormatter(p_format) d_file_handler.setFormatter(f_format)