From a3f7f4adfb8d34b7bf9e131e0413f53a4fecf36b Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Tue, 11 Oct 2022 06:15:26 +0200 Subject: [PATCH] Completely disabled file based logging as it is broken by design. --- bin/linspector | 2 +- etc/linspector.conf | 2 +- linspector/core/logger.py | 42 +++++++++++++++++++-------------------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/bin/linspector b/bin/linspector index 96ae35a..96d0148 100755 --- a/bin/linspector +++ b/bin/linspector @@ -33,7 +33,7 @@ from linspector.core.monitors import Monitors # i currently only increase the 3rd number because the goal is that 0.19.* will become the first # stable version. -__version__ = '0.19.59.dev1' +__version__ = '0.19.60.dev1' __author__ = 'Johannes Findeisen ' diff --git a/etc/linspector.conf b/etc/linspector.conf index 644e643..484706f 100644 --- a/etc/linspector.conf +++ b/etc/linspector.conf @@ -4,7 +4,7 @@ error_receivers = admin@example.com ; available log levels are: "error", "warning", "info" and "debug". if no log_level is set, it will be critical only. log_level= debug -log_file = ~/code/linspector/linspector/log/linspector.log +;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 = 20 diff --git a/linspector/core/logger.py b/linspector/core/logger.py index 3476c73..d325cea 100644 --- a/linspector/core/logger.py +++ b/linspector/core/logger.py @@ -59,31 +59,31 @@ class Log: if not os.path.exists(os.path.dirname(log_file)): os.makedirs(os.path.dirname(log_file)) - log_file_formatter = \ - logging.Formatter('[%(asctime)s]:[%(levelname)s]:[%(name)s]:%(message)s') + log_file_formatter = \ + logging.Formatter('[%(asctime)s]:[%(levelname)s]:[%(name)s]:%(message)s') - if 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_bytes = int(10000000) + if 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_bytes = int(10000000) - if configuration.get_option('linspector', 'log_file_count'): - log_file_count = int(configuration.get_option('linspector', 'log_file_count')) - else: - # default log file count is 1. - log_file_count = 1 + if configuration.get_option('linspector', 'log_file_count'): + log_file_count = int(configuration.get_option('linspector', 'log_file_count')) + else: + # default log file count is 1. + log_file_count = 1 - log_file_handler = logging.handlers.RotatingFileHandler(log_file, - maxBytes=log_file_size_bytes, - backupCount=log_file_count) + log_file_handler = logging.handlers.RotatingFileHandler(log_file, + maxBytes=log_file_size_bytes, + backupCount=log_file_count) - log_file_handler.setFormatter(log_file_formatter) - self.add_handler(log_file_handler) + log_file_handler.setFormatter(log_file_formatter) + self.add_handler(log_file_handler) log_level = 'None' # critical errors will always show up even when no log_level is set. this is most silent.