5

Here is a program that causes doubled Tensorflow logging messages:

import tensorflow as tf
import logging

logging.basicConfig(level=logging.INFO)
tf.logging.info("tf version %s" % tf.__version__)

Output:

INFO:tensorflow:tf version 1.4.0
INFO:tensorflow:tf version 1.4.0

This stackoverflow answer says to 1) to turn off logger propagation on the custom logger; 2) it will be fixed soon (in Nov 2015, over two years ago).

I wanted to turn off log message propagation on the Tensorflow logger, and found this post that suggested the following as a hack just for a REPL (i.e. interactively):

tf.logging._logger.propagate = False

Works like a charm.

But .. is there a better way?

Stefan Falk
  • 23,898
  • 50
  • 191
  • 378
dfrankow
  • 20,191
  • 41
  • 152
  • 214
  • Unfortunately `tf.logging._logger.propagate = False` does not work for me. Same for `tf.logging.propagate = False` – Stefan Falk Feb 05 '19 at 13:00

0 Answers0