diff --git a/swh/archiver/checker.py b/swh/archiver/checker.py --- a/swh/archiver/checker.py +++ b/swh/archiver/checker.py @@ -36,6 +36,7 @@ } }), 'batch_size': ('int', 1000), + 'log_tag': ('str', 'objstorage.checker') } CONFIG_BASE_FILENAME = 'objstorage/objstorage_checker' @@ -46,6 +47,7 @@ self.config = self.parse_config_file() self.objstorage = get_objstorage(**self.config['storage']) self.batch_size = self.config['batch_size'] + self.logger = logging.getLogger(self.config['log_tag']) def run_as_daemon(self): """ Start the check routine and perform it forever. @@ -56,8 +58,8 @@ while True: try: self.run() - except: - pass + except Exception: + self.logger.exception('Unexpected error.') def run(self): """ Check a batch of content. @@ -108,25 +110,8 @@ class LogContentChecker(BaseContentChecker): """ Content integrity checker that just log detected errors. """ - - DEFAULT_CONFIG = { - 'storage': ('dict', { - 'cls': 'pathslicing', - 'args': { - 'root': '/srv/softwareheritage/objects', - 'slicing': '0:2/2:4/4:6' - } - }), - 'batch_size': ('int', 1000), - 'log_tag': ('str', 'objstorage.checker') - } - CONFIG_BASE_FILENAME = 'objstorage/log_checker' - def __init__(self): - super().__init__() - self.logger = logging.getLogger(self.config['log_tag']) - def corrupted_content(self, obj_id): """ Perform an action to treat with a corrupted content. """