I use tensorflow 1.2.0
installed with pip install
.
When I run samples that include
import logging
tf.logging.set_verbosity(tf.
So there is a lot of confusion around tensorflow logging, and it is really not well documented. I landed here a few times in my searches, so it seems to be a good place to post an answer.
After some research and experimentation with Ubuntu and Windows (more than I had planned), this is what I got:
There are two flags, similarly named, but with somewhat different semantics:
TF_CPP_MIN_LOG_LEVEL
- which has 3 or 4 basic levels - low numbers = more messages.
0
outputs Information, Warning, Error, and Fatals (default)1
outputs Warning, and above 2
outputs Errors and above.TF_CPP_MIN_VLOG_LEVEL
- which causes very very many extra Information errors - really for debugging only - low numbers = less messages.
3
Outputs lots and lots of stuff2
Outputs less1
Outputs even less0
Outputs nothing extra (default)python tf-program.py &>mylog.log
os
module so you should be able to set them in the environmentos
module did not pick them up under Windows. Python never loved Windows...
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '0'
os.environ['TF_CPP_MIN_VLOG_LEVEL'] = '3'
import tensorflow as tf
TF_CPP_MIN_VLOG_LEVEL=3 python tf-program.py
FWIW, I tested on TensorFlow 1.7 with this tutorial:
https://github.com/tensorflow/models/tree/master/tutorials/image/mnist
And this is what it looks like: