abbbi / virtnbdbackup

Backup utility for Libvirt / qemu / kvm supporting incremental and differential backups + instant recovery (agentless).
http://libvirtbackup.grinser.de/
GNU General Public License v3.0
330 stars 46 forks source link

Standard output python logging errors - KeyError: 'light_blue' #148

Closed de666 closed 10 months ago

de666 commented 10 months ago

Version used 1.9.48

Describe the bug Lot of python logging errors on standard output when running backup from docker image, all similar to this

--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.9/logging/__init__.py", line 430, in format
    return self._format(record)
  File "/usr/lib/python3.9/logging/__init__.py", line 426, in _format
    return self._fmt % record.__dict__
KeyError: 'light_blue'

and all ending with

KeyError: 'light_blue'

Expected behavior No errors

Hypervisor information:

Logfiles: Backup logs are ok, it seems it's an issue related to the standard output

abbbi commented 10 months ago

Strange, which Version of the Python colorlog Module do you have installed? How did you install virtnbdbackup? The issue is within the log output color module Not virtnbdbackup itself.

you can probably workaround if you Use the --nocolor Option. Seems like there is a incompatible Version of the colorlog module installed on your System

draggeta commented 10 months ago

I'm having the same problem. I'm using the docker container and it reports this as well:

ValueError: Formatting field not found in record: 'light_blue'   

Adding --nocolor does help so it's fine for me.

abbbi commented 10 months ago

which docker container? I dont maintain any official docker images for virtnbdbackup, only the scripts to create the container by yourself. Might well be that the docker container used is shipping very old versions of the python-colorlog module.

Official debian and other rpm based distributions ship python3-colorlog which has the light_blue color defined:

grep light_blue /usr/lib/python3/dist-packages/colorlog/escape_codes.py
    "light_blue": 94,
    "light_blue": 104,
dpkg -S /usr/lib/python3/dist-packages/colorlog/escape_codes.py
python3-colorlog: /usr/lib/python3/dist-packages/colorlog/escape_codes.py

The light color codes have been introduced in python-colorlog as with version:

"6.0.0-alpha.2"

which was nearly 2 years ago:

https://github.com/borntyping/python-colorlog/commit/7d1709770bb723aa2e7a056463870df31ebee6bf

at least python-colorlog version 6.4.1 is required, ive added a more strict dependency in requirements.txt now.

So to fix this issue:

1) use a docker container that uses more recent OS/Packages or build the container by yourself 2) update python3-colorlog module or use an venv if your distribution doesnt ship at least version 6.4.1 3) use --nocolor option to workaorund.

draggeta commented 10 months ago

I wasn't clear enough. I use the dockerfile in this repository to build the container. It seems that the used base image (bullseye) doesn't have a newer version available:

/# apt list python3-colorlog
Listing... Done
python3-colorlog/now 4.7.2-1 all [installed,local] 
abbbi commented 10 months ago

Thanks, i rarely use the docker images. They use on debian bullseye. Ill change the dockerfile to use bookworm

abbbi commented 10 months ago

@adrianparilli you might want to consider updating your docker images aswell

abbbi commented 10 months ago

hmm.. i reconsidered. Im using the color code regular "blue" now which is available in all colorlog verisons. Its bad to lose compatiblity with older debian and rhel distributions just for a slight color change.

draggeta commented 10 months ago

Thank you for the quick fix by the way 👍