1,通过设置环境变量"TF_CPP_MIN_LOG_LEVEL"控制log级别
Level Level for Humans Level Description
0 DEBUG all messages are logged (Default)
1 INFO INFO messages are not printed
2 WARNING INFO and WARNING messages are not printed
3 ERROR INFO, WARNING, and ERROR messages are not printed
永久设置:加入环境变量TF_CPP_MIN_LOG_LEVEL=1
临时设置:os.environ['TF_CPP_MIN_LOG_LEVEL']='1'
2.通过 tf.logging 模块进行设置 – 推荐
tf.logging.set_verbosity(tf.logging.ERROR)
tf.logging.ERROR可以换成 {DEBUG, INFO, WARN, ERROR, FATAL} 中的任何一个。