bandersnatch icon indicating copy to clipboard operation
bandersnatch copied to clipboard

Setting log-config option in config errors about formatters

Open cooperlees opened this issue 3 years ago • 1 comments

Running with the 1log-config` setting we currently crash. Example config:

[mirror]
...
log-config = /data/pip/bandersnatch-log.conf
...

Causes:

crl-m1:bandersnatch cooper$ /tmp/tb/bin/bandersnatch --debug -c /tmp/bandersnatch.conf mirror 2>&1 | tee /tmp/bandersnatch_run_1
Traceback (most recent call last):
  File "/tmp/tb/bin/bandersnatch", line 8, in <module>
    sys.exit(main())
  File "/private/tmp/tb/lib/python3.9/site-packages/bandersnatch/main.py", line 215, in main
    logging.config.fileConfig(str(Path(config.get("mirror", "log-config"))))
  File "/opt/homebrew/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/logging/config.py", line 71, in fileConfig
    formatters = _create_formatters(cp)
  File "/opt/homebrew/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/logging/config.py", line 104, in _create_formatters
[mirror]
    flist = cp["formatters"]["keys"]
  File "/opt/homebrew/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/configparser.py", line 963, in __getitem__
    raise KeyError(key)
KeyError: 'formatters'

cooperlees avatar Feb 14 '22 07:02 cooperlees

I came back to look at this to land - But this didn't ned a fix, this option requires a valid Python logging ini config, so it

I will take a PR making the logging clearer or something here. But putting low priority for me at the moment.

cooperlees avatar Feb 20 '22 23:02 cooperlees