Controlling output verbosity: log level in dolfinx and ffcx

ffcx is very chatty, generating a detailed report of its build flags everytime it’s invoked. We want to be able to control the level of detail about internal conditions that dolfinx emits.

In dolfinx itself that’s easy to do via the log submodule, which uses logging via https://emilk.github.io/loguru/#logging/verbositylevels . For example

dolfinx.log.set_log_level(dolfinx.log.LogLevel.WARNING)

set dolfinx to only show messages that you likely don’t want to miss. It’s the default setting actually. dolfinx.log.LogLevel.INFO will generate much more detail than you normally want to see.

The problem is that ffcx is not conforming to the log level set by dolfinx. Even with the dolfinx log level set to dolfinx.log.LogLevel.ERROR, ffcx still emits information at level INFO, e.g.

INFO:root:running build_ext
INFO:root:building 'libffcx_forms_72a13a0073e0e707a24eded92368a528a8136c1c' extension
INFO:root:x86_64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/lib/python3/dist-packages/ffcx/codegeneration -I/usr/include/python3.11 -c libffcx_forms_72a13a0073e0e707a24eded92368a528a8136c1c.c -o ./libffcx_forms_72a13a0073e0e707a24eded92368a528a8136c1c.o -O2 -g0
INFO:root:x86_64-linux-gnu-gcc -shared -Wl,-O1 -Wl,-Bsymbolic-functions -g -fwrapv -O2 ./libffcx_forms_72a13a0073e0e707a24eded92368a528a8136c1c.o -L/usr/lib/x86_64-linux-gnu -o ./libffcx_forms_72a13a0073e0e707a24eded92368a528a8136c1c.cpython-311-x86_64-linux-gnu.so

Maybe it’s a bug.

What’s the appropriate workaround that one would use in a dolfinx python script to stop ffcx emitting this kind of info?

Apparently there is a convergence of irritation,

I will try applying the patch from FFCx logger leaking information with setuptools>65.5.1 · Issue #553 · FEniCS/ffcx · GitHub

1 Like