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

Hello,
I have the same issue, how did you solve it?

The link I gave linked to the patch at

1 Like

I am having the same problem. I am using vscode in WSL and running time dependent calculations that cover too many time iterations causes vscode to run out of memory, presumably because of all the log info that is generated.

I’m sorry to say that I can’t understand the fixes for this that are suggested above. Can someone help me to turn off my log info? The current setting
log.set_log_level(dolfinx.log.LogLevel.OFF)
is not helping here.

Upgrade to v0.8, as it has been Fixed in that release.

You have not specified how you installed DOLFINx or what version you are using, making it hard to give any other advice.

I was running version 0.7. Upgrading to version 0.8 fixed the problem. Thanks