How to prevent a lot of logs output in TensorFlow?

tensorflow bash logs

Often TensorFlow will flood us with logs. While these might be relevant in early development, will simply annoy on production environment.

Silencing TensorFlow

This entry was tested in TensorFlow 2.11 and 2.12, might apply to other versions too

To prevent those log clogging up the screen, ensure that environment variable TF_CPP_MIN_LOG_LEVEL with value 2, example in bash:


To have this permanently set you can add above statement to .bashrc file or /etc/environment to set it globally.