Completely disabled file based logging as it is broken by design.

This commit is contained in:
Johannes Findeisen 2022-10-11 06:15:26 +02:00
commit a3f7f4adfb
3 changed files with 27 additions and 27 deletions

View file

@ -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 # i currently only increase the 3rd number because the goal is that 0.19.* will become the first
# stable version. # stable version.
__version__ = '0.19.59.dev1' __version__ = '0.19.60.dev1'
__author__ = 'Johannes Findeisen <you@hanez.org>' __author__ = 'Johannes Findeisen <you@hanez.org>'

View file

@ -4,7 +4,7 @@
error_receivers = admin@example.com 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. ; available log levels are: "error", "warning", "info" and "debug". if no log_level is set, it will be critical only.
log_level= debug 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 ; 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. ; the size of the log file higher to increase the log history.
log_file_count = 20 log_file_count = 20

View file

@ -59,31 +59,31 @@ class Log:
if not os.path.exists(os.path.dirname(log_file)): if not os.path.exists(os.path.dirname(log_file)):
os.makedirs(os.path.dirname(log_file)) os.makedirs(os.path.dirname(log_file))
log_file_formatter = \ log_file_formatter = \
logging.Formatter('[%(asctime)s]:[%(levelname)s]:[%(name)s]:%(message)s') logging.Formatter('[%(asctime)s]:[%(levelname)s]:[%(name)s]:%(message)s')
if configuration.get_option('linspector', 'log_file_size'): if configuration.get_option('linspector', 'log_file_size'):
log_file_size_mb = 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) log_file_size_bytes = int(log_file_size_mb * 1000000)
elif configuration.get_option('linspector', 'log_file_size_bytes'): elif configuration.get_option('linspector', 'log_file_size_bytes'):
log_file_size_bytes = int(configuration.get_option('linspector', log_file_size_bytes = int(configuration.get_option('linspector',
'log_file_size_bytes')) 'log_file_size_bytes'))
else: else:
# default log file size is 10000000 bytes (10MiB) # default log file size is 10000000 bytes (10MiB)
log_file_size_bytes = int(10000000) log_file_size_bytes = int(10000000)
if configuration.get_option('linspector', 'log_file_count'): if configuration.get_option('linspector', 'log_file_count'):
log_file_count = int(configuration.get_option('linspector', 'log_file_count')) log_file_count = int(configuration.get_option('linspector', 'log_file_count'))
else: else:
# default log file count is 1. # default log file count is 1.
log_file_count = 1 log_file_count = 1
log_file_handler = logging.handlers.RotatingFileHandler(log_file, log_file_handler = logging.handlers.RotatingFileHandler(log_file,
maxBytes=log_file_size_bytes, maxBytes=log_file_size_bytes,
backupCount=log_file_count) backupCount=log_file_count)
log_file_handler.setFormatter(log_file_formatter) log_file_handler.setFormatter(log_file_formatter)
self.add_handler(log_file_handler) self.add_handler(log_file_handler)
log_level = 'None' log_level = 'None'
# critical errors will always show up even when no log_level is set. this is most silent. # critical errors will always show up even when no log_level is set. this is most silent.