From 7806511884e76e258c33865a7dc38d86984558d5 Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Thu, 6 Oct 2022 23:20:37 +0200 Subject: [PATCH] Reverted some of the last commit. Megabytes make sense for log_file_size. --- bin/linspector | 14 +++++++++----- etc/linspector.conf | 7 +++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/bin/linspector b/bin/linspector index 7bfabc5..338f437 100755 --- a/bin/linspector +++ b/bin/linspector @@ -37,7 +37,7 @@ logger = logging.getLogger('linspector') # i currently only increase the 3rd number because the goal is that 0.19.* will become the first # stable version. -__version__ = '0.19.39.dev1' +__version__ = '0.19.40.dev1' __author__ = 'Johannes Findeisen ' @@ -111,10 +111,14 @@ def main(): logging.Formatter('[%(asctime)s]:[%(levelname)s]:[%(name)s]:%(message)s') if configuration.get_option('linspector', 'log_file_size'): - log_file_size = int(configuration.get_option('linspector', 'log_file_size')) + log_file_size_mb = int(configuration.get_option('linspector', 'log_file_size')) + log_file_size_bytes = int(log_file_size_mb * 1000000) + elif configuration.get_option('linspector', 'log_file_size_bytes'): + log_file_size_bytes = int(configuration.get_option('linspector', + 'log_file_size_bytes')) else: - # default log file size is 10000000 bytes (10MiB) - log_file_size = int(10000000) + # default log file size is 10000000 bytes + log_file_size_bytes = int(10000000) if configuration.get_option('linspector', 'log_file_count'): log_file_count = int(configuration.get_option('linspector', 'log_file_count')) @@ -123,7 +127,7 @@ def main(): log_file_count = 1 log_file_handler = logging.handlers.RotatingFileHandler(log_file, - maxBytes=log_file_size, + maxBytes=log_file_size_bytes, backupCount=log_file_count) log_file_handler.setFormatter(log_file_formatter) diff --git a/etc/linspector.conf b/etc/linspector.conf index 83dfd96..e2b7a1a 100644 --- a/etc/linspector.conf +++ b/etc/linspector.conf @@ -8,8 +8,11 @@ log_file = ~/code/linspector/linspector/log/linspector.log ; number of log files to be kept. i recommend to use the lowest sensible value for keeping performance high. so set ; the size of the log file higher to increase the log history. log_file_count = 10 -; log file size in bytes as int. the default is 10000000 bytes (10MiB) if not set here to a different value. -log_file_size = 1000000 +; log file size in megabytes as int. +log_file_size = 1 +; log file size in bytes as int. you can set to bytes if you want to set a value lower then 1 megabyte. but it will +; only be used when log_file_size is not set. the default is 1000000 (10MiB) in the code if not set here. +log_file_size_bytes = 100000 pid_file = /var/run/user/1000/linspector.pid ; plugins separated by ','. no whitespaces allowed! not case sensitive. plugins = Lish,HTTPServer