Package: borgmatic Version: 1.8.3-1 Severity: normal Dear Maintainer,
TL;DR: A Python exception pollutes the output when using borgmatic 1.8.3 with invalid parameters or other configuration problems. This issue is corrected in later versions, but here is a small patch to correct it. I made a migration from a previous borgmatic version with different parameters and faced this issue with bormatic 1.8.3 : When using incorrect parameters (in CLI), borgmatic prints a Python exception about the DISABLED property being undefined on the logging module. By example : ---------------------------------------- > borgmatic prunee usage: borgmatic [-h] [-c CONFIG_PATHS] [-n] [-nc] [-v {-2,-1,0,1,2}] [--syslog-verbosity {-2,-1,0,1,2}] [--log-file-verbosity {-2,-1,0,1,2}] [--monitoring-verbosity {-2,-1,0,1,2}] [--log-file LOG_FILE] [--log-file-format LOG_FILE_FORMAT] [--log-json] [--override OPTION.SUBOPTION=VALUE] [--no-environment-interpolation] [--bash-completion] [--fish-completion] [--version] ... Traceback (most recent call last): File "/usr/lib/python3/dist-packages/borgmatic/commands/borgmatic.py", line 816, in main arguments = parse_arguments(*sys.argv[1:]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/borgmatic/commands/arguments.py", line 1283, in parse_arguments raise ValueError( ValueError: Unrecognized argument: prunee During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/bin/borgmatic", line 33, in <module> sys.exit(load_entry_point('borgmatic==1.8.3', 'console_scripts', 'borgmatic')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/borgmatic/commands/borgmatic.py", line 818, in main configure_logging(logging.CRITICAL) File "/usr/lib/python3/dist-packages/borgmatic/logger.py", line 170, in configure_logging syslog_log_level = logging.DISABLED ^^^^^^^^^^^^^^^^ AttributeError: module 'logging' has no attribute 'DISABLED' ---------------------------------------- This issue is, in a sense, cosmetic, but pollutes the logs with useless stacktraces. It comes from logger.py, where the custom DISABLED status is being used (line 170) before being defined (line 176). This issue is corrected in borgmatic 1.8.4, but it can be corrected too in 1.8.3 with the following patch : ---------------------------------------- --- /usr/lib/python3/dist-packages/borgmatic/logger.py 2024-02-18 08:45:36.101652793 +0100 +++ /usr/lib/python3/dist-packages/borgmatic/logger-ok.py 2024-02-18 08:47:19.790311543 +0100 @@ -166,6 +166,9 @@ Raise FileNotFoundError or PermissionError if the log file could not be opened for writing. ''' + + add_custom_log_levels() + if syslog_log_level is None: syslog_log_level = logging.DISABLED if log_file_log_level is None: @@ -173,8 +176,6 @@ if monitoring_log_level is None: monitoring_log_level = console_log_level - add_custom_log_levels() - # Log certain log levels to console stderr and others to stdout. This supports use cases like # grepping (non-error) output. console_disabled = logging.NullHandler() ---------------------------------------- Resulting in the following output for the same command : ---------------------------------------- > borgmatic -c /etc/borgmatic.d/wordpress-bb.yaml prunee --list --stats usage: borgmatic [-h] [-c CONFIG_PATHS] [-n] [-nc] [-v {-2,-1,0,1,2}] [--syslog-verbosity {-2,-1,0,1,2}] [--log-file-verbosity {-2,-1,0,1,2}] [--monitoring-verbosity {-2,-1,0,1,2}] [--log-file LOG_FILE] [--log-file-format LOG_FILE_FORMAT] [--log-json] [--override OPTION.SUBOPTION=VALUE] [--no-environment-interpolation] [--bash-completion] [--fish-completion] [--version] ... Unrecognized argument: prunee Need some help? https://torsion.org/borgmatic/#issues ---------------------------------------- Thnks for reading me :) -- System Information: Debian Release: trixie/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 6.6.13-amd64 (SMP w/2 CPU threads; PREEMPT) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages borgmatic depends on: ii borgbackup 1.2.7-2 ii python3 3.11.6-1 ii python3-colorama 0.4.6-4 ii python3-jsonschema 4.10.3-2 ii python3-packaging 23.2-1 ii python3-pkg-resources 68.1.2-2 ii python3-requests 2.31.0+dfsg-1 ii python3-ruamel.yaml 0.17.21-1 borgmatic recommends no packages. borgmatic suggests no packages. -- no debconf information