saimn / sigal

yet another simple static gallery generator
http://sigal.saimon.org/
MIT License
893 stars 170 forks source link

Changes to the log level only affect the 'sigal' logger #502

Open Canyoneer opened 1 year ago

Canyoneer commented 1 year ago

The --verbose and --debug options only change the log level for the 'sigal' logger. This means that many logging messages will still not be visible, since they use a logger with a different name derived from the modules name. For example 'sigal.video' inside the video module, but also other modules, plugins and libaries.

In my chase the system couldn't find ffmpeg and couldn't get a proper log even with the --debug option.

I changed this in my local build by adding "logging.basicConfig(level=level)" at the start of the init_logging function. But I have no idea if this is the right way to do this.

saimn commented 1 year ago

I cannot reproduce, the submodule loggers inherit the parent's configuration. Example with the test gallery after adding some fake option to ffmpeg:

DEBUG: Video size: 240, 98 -> 480, 360
DEBUG: Processing video: ffmpeg -i /home/simon/dev/sigal/tests/sample/pictures/video/example video.ogv -y -crf scoubidou 10 -b:v 1.6M -qmin 4 plop-qmax 63 /home/simon/dev/sigal/tests/sample/_build/video/example video.webm
DEBUG: STDOUT:

DEBUG: STDERR:
 ffmpeg version n6.0 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.2.1 (GCC) 20230801
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-vulkan
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Unrecognized option 'crf scoubidou'.
Error splitting the argument list: Option not found
Canyoneer commented 1 year ago

Thanks for the feedback. I'm quite certain now that this issue is OS specific. I testet it on Debian 12 and --debug works fine there. On Windows it does not. Have you tested on Windows?

It seems that multiprocessing works differently on Windows (no fork), so the log is not inherited on Windows subprocesses. But I couldn't find a recommended solution for this yet.

saimn commented 11 months ago

No I have never tested on Windows. There are some bug report on Windows (https://github.com/saimn/sigal/labels/windows) so I guess it more or less works but I cannot help with the debugging ;). Also would be great to have a CI job on Windows, if someone is motivated to do that (and fix the bugs :)).